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

Method testSpacials

Engine/source/T3D/physics/physx3/px3Player.cpp:326–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326bool Px3Player::testSpacials(const Point3F &nPos, const Point3F &nSize) const
327{
328 F32 offset = nSize.z * 0.5f;
329 F32 radius = getMax(nSize.x, nSize.y) * 0.5f - mSkinWidth;
330 F32 height = (nSize.z - (radius * 2.0f)) * 0.5f;
331 height -= mSkinWidth * 2.0f;
332 physx::PxCapsuleGeometry geom(radius, height);
333
334 physx::PxVec3 pos(nPos.x, nPos.y, nPos.z + offset);
335 physx::PxQuat orientation(Float_HalfPi, physx::PxVec3(0.0f, 1.0f, 0.0f));
336
337 physx::PxOverlapBuffer hit;
338 physx::PxQueryFilterData queryFilter(physx::PxQueryFlag::eANY_HIT | physx::PxQueryFlag::eSTATIC | physx::PxQueryFlag::eDYNAMIC);
339 queryFilter.data.word0 = PX3_DEFAULT;
340 bool hasHit = mWorld->getScene()->overlap(geom, physx::PxTransform(pos, orientation), hit, queryFilter);
341
342 return !hasHit; // Return true if there are no overlapping objects
343}
344
345void Px3Player::setSpacials(const Point3F &nPos, const Point3F &nSize)
346{

Callers 3

canCrouchMethod · 0.45
canStandMethod · 0.45
canProneMethod · 0.45

Calls 3

getMaxFunction · 0.85
overlapMethod · 0.45
getSceneMethod · 0.45

Tested by

no test coverage detected