| 324 | } |
| 325 | |
| 326 | bool 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 | |
| 345 | void Px3Player::setSpacials(const Point3F &nPos, const Point3F &nSize) |
| 346 | { |