| 375 | } |
| 376 | |
| 377 | void Item::_updatePhysics() |
| 378 | { |
| 379 | SAFE_DELETE( mPhysicsRep ); |
| 380 | |
| 381 | if ( !PHYSICSMGR ) |
| 382 | return; |
| 383 | |
| 384 | if (mDataBlock->simpleServerCollision) |
| 385 | { |
| 386 | // We only need the trigger on the server. |
| 387 | if ( isServerObject() ) |
| 388 | { |
| 389 | PhysicsCollision *colShape = PHYSICSMGR->createCollision(); |
| 390 | colShape->addBox( mObjBox.getExtents() * 0.5f, MatrixF::Identity ); |
| 391 | |
| 392 | PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" ); |
| 393 | mPhysicsRep = PHYSICSMGR->createBody(); |
| 394 | mPhysicsRep->init( colShape, 0, PhysicsBody::BF_TRIGGER | PhysicsBody::BF_KINEMATIC, this, world ); |
| 395 | mPhysicsRep->setTransform( getTransform() ); |
| 396 | } |
| 397 | } |
| 398 | else |
| 399 | { |
| 400 | if ( !mShapeInstance ) |
| 401 | return; |
| 402 | |
| 403 | PhysicsCollision* colShape = mShapeInstance->getShape()->buildColShape( false, getScale() ); |
| 404 | |
| 405 | if ( colShape ) |
| 406 | { |
| 407 | PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" ); |
| 408 | mPhysicsRep = PHYSICSMGR->createBody(); |
| 409 | mPhysicsRep->init( colShape, 0, PhysicsBody::BF_KINEMATIC, this, world ); |
| 410 | mPhysicsRep->setTransform( getTransform() ); |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | bool Item::onNewDataBlock( GameBaseData *dptr, bool reload ) |
| 416 | { |
nothing calls this directly
no test coverage detected