| 5338 | } |
| 5339 | |
| 5340 | void Player::findContact( bool *run, bool *jump, VectorF *contactNormal ) |
| 5341 | { |
| 5342 | SceneObject *contactObject = NULL; |
| 5343 | |
| 5344 | Vector<SceneObject*> overlapObjects; |
| 5345 | if ( mPhysicsRep ) |
| 5346 | mPhysicsRep->findContact( &contactObject, contactNormal, &overlapObjects ); |
| 5347 | else |
| 5348 | _findContact( &contactObject, contactNormal, &overlapObjects ); |
| 5349 | |
| 5350 | // Check for triggers, corpses and items. |
| 5351 | const U32 filterMask = isGhost() ? sClientCollisionContactMask : sServerCollisionContactMask; |
| 5352 | for ( U32 i=0; i < overlapObjects.size(); i++ ) |
| 5353 | { |
| 5354 | SceneObject *obj = overlapObjects[i]; |
| 5355 | U32 objectMask = obj->getTypeMask(); |
| 5356 | |
| 5357 | if ( !( objectMask & filterMask ) ) |
| 5358 | continue; |
| 5359 | |
| 5360 | // Check: triggers, corpses and items... |
| 5361 | // |
| 5362 | if (objectMask & TriggerObjectType) |
| 5363 | { |
| 5364 | Trigger* pTrigger = static_cast<Trigger*>( obj ); |
| 5365 | pTrigger->potentialEnterObject(this); |
| 5366 | } |
| 5367 | else if (objectMask & CorpseObjectType) |
| 5368 | { |
| 5369 | // If we've overlapped the worldbounding boxes, then that's it... |
| 5370 | if ( getWorldBox().isOverlapped( obj->getWorldBox() ) ) |
| 5371 | { |
| 5372 | ShapeBase* col = static_cast<ShapeBase*>( obj ); |
| 5373 | queueCollision(col,getVelocity() - col->getVelocity()); |
| 5374 | } |
| 5375 | } |
| 5376 | else if (objectMask & ItemObjectType) |
| 5377 | { |
| 5378 | // If we've overlapped the worldbounding boxes, then that's it... |
| 5379 | Item* item = static_cast<Item*>( obj ); |
| 5380 | if ( getWorldBox().isOverlapped(item->getWorldBox()) && |
| 5381 | item->getCollisionObject() != this && |
| 5382 | !item->isHidden() ) |
| 5383 | queueCollision(item,getVelocity() - item->getVelocity()); |
| 5384 | } |
| 5385 | } |
| 5386 | |
| 5387 | F32 vd = (*contactNormal).z; |
| 5388 | *run = vd > mDataBlock->runSurfaceCos; |
| 5389 | *jump = vd > mDataBlock->jumpSurfaceCos; |
| 5390 | |
| 5391 | mContactInfo.clear(); |
| 5392 | |
| 5393 | mContactInfo.contacted = contactObject != NULL; |
| 5394 | mContactInfo.contactObject = contactObject; |
| 5395 | |
| 5396 | if ( mContactInfo.contacted ) |
| 5397 | mContactInfo.contactNormal = *contactNormal; |
nothing calls this directly
no test coverage detected