MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _findContact

Method _findContact

Engine/source/T3D/player.cpp:5263–5338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5261//----------------------------------------------------------------------------
5262
5263void Player::_findContact( SceneObject **contactObject,
5264 VectorF *contactNormal,
5265 Vector<SceneObject*> *outOverlapObjects )
5266{
5267 Point3F pos;
5268 getTransform().getColumn(3,&pos);
5269
5270 Box3F wBox;
5271 Point3F exp(0,0,sTractionDistance);
5272 wBox.minExtents = pos + mScaledBox.minExtents - exp;
5273 wBox.maxExtents.x = pos.x + mScaledBox.maxExtents.x;
5274 wBox.maxExtents.y = pos.y + mScaledBox.maxExtents.y;
5275 wBox.maxExtents.z = pos.z + mScaledBox.minExtents.z + sTractionDistance;
5276
5277 static ClippedPolyList polyList;
5278 polyList.clear();
5279 polyList.doConstruct();
5280 polyList.mNormal.set(0.0f, 0.0f, 0.0f);
5281 polyList.setInterestNormal(Point3F(0.0f, 0.0f, -1.0f));
5282
5283 polyList.mPlaneList.setSize(6);
5284 polyList.mPlaneList[0].setYZ(wBox.minExtents, -1.0f);
5285 polyList.mPlaneList[1].setXZ(wBox.maxExtents, 1.0f);
5286 polyList.mPlaneList[2].setYZ(wBox.maxExtents, 1.0f);
5287 polyList.mPlaneList[3].setXZ(wBox.minExtents, -1.0f);
5288 polyList.mPlaneList[4].setXY(wBox.minExtents, -1.0f);
5289 polyList.mPlaneList[5].setXY(wBox.maxExtents, 1.0f);
5290 Box3F plistBox = wBox;
5291
5292 // Expand build box as it will be used to collide with items.
5293 // PickupRadius will be at least the size of the box.
5294 F32 pd = (F32)mDataBlock->pickupDelta;
5295 wBox.minExtents.x -= pd; wBox.minExtents.y -= pd;
5296 wBox.maxExtents.x += pd; wBox.maxExtents.y += pd;
5297 wBox.maxExtents.z = pos.z + mScaledBox.maxExtents.z;
5298
5299 // Build list from convex states here...
5300 CollisionWorkingList& rList = mConvex.getWorkingList();
5301 CollisionWorkingList* pList = rList.wLink.mNext;
5302 while (pList != &rList)
5303 {
5304 Convex* pConvex = pList->mConvex;
5305
5306 U32 objectMask = pConvex->getObject()->getTypeMask();
5307
5308 if ( ( objectMask & sCollisionMoveMask ) &&
5309 !( objectMask & PhysicalZoneObjectType ) )
5310 {
5311 Box3F convexBox = pConvex->getBoundingBox();
5312 if (plistBox.isOverlapped(convexBox))
5313 pConvex->getPolyList(&polyList);
5314 }
5315 else
5316 outOverlapObjects->push_back( pConvex->getObject() );
5317
5318 pList = pList->wLink.mNext;
5319 }
5320

Callers

nothing calls this directly

Calls 15

getColumnMethod · 0.80
setInterestNormalMethod · 0.80
setYZMethod · 0.80
setXZMethod · 0.80
setXYMethod · 0.80
getTypeMaskMethod · 0.80
isOverlappedMethod · 0.60
Point3FClass · 0.50
clearMethod · 0.45
doConstructMethod · 0.45
setMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected