PxTransform Sq::getGlobalPose(const Scb::Shape& scbShape, const Scb::Actor& scbActor) { PxActorType::Enum actorType = scbActor.getActorType(); if(actorType==PxActorType::eRIGID_STATIC) { return static_cast<const Scb::RigidStatic&>(scbActor).getActor2World() * scbShape.getShape2Actor(); } else { PX_ASSERT(actorType==PxActorType::eRIGID_DYNAMIC || actorType == PxActorType::eARTICULATION_LINK); PxTransform body2World; const Scb::Body& body = static_cast<const Scb::Body&>(scbActor); if (!(body.getFlags() & PxRigidBodyFlag::eKINEMATIC)) body2World = body.getBody2World(); else { PxTransform bodyTarget; if (!body.getKinematicTarget(bodyTarget) || (!(body.getFlags() & PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES))) body2World = body.getBody2World(); else body2World = bodyTarget; } return body2World * body.getBody2Actor().getInverse() * scbShape.getShape2Actor(); } }
static PxBounds3 computeWorldAABB(const Scb::Shape& scbShape, const Sc::BodyCore& bodyCore) { const Gu::GeometryUnion& geom = scbShape.getGeometryUnion(); const PxTransform& shape2Actor = scbShape.getShape2Actor(); PX_ALIGN(16, PxTransform) globalPose; PX_ALIGN(16, PxTransform) kinematicTarget; PxU16 sqktFlags = PxRigidBodyFlag::eKINEMATIC | PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES; bool useTarget = (PxU16(bodyCore.getFlags()) & sqktFlags) == sqktFlags; const PxTransform& body2World = (useTarget && bodyCore.getKinematicTarget(kinematicTarget)) ? kinematicTarget : bodyCore.getBody2World(); Cm::getDynamicGlobalPoseAligned(body2World, shape2Actor, bodyCore.getBody2Actor(), globalPose); PxBounds3 tmp; inflateBounds(tmp, Gu::computeBounds(geom.getGeometry(), globalPose, false)); return tmp; }
PxBounds3 Sq::computeWorldAABB(const Scb::Shape& scbShape, const Scb::Actor& scbActor) { PxActorType::Enum actorType = scbActor.getActorType(); const Gu::GeometryUnion& geom = scbShape.getGeometryUnion(); const PxTransform& shape2Actor = scbShape.getShape2Actor(); PX_ALIGN(16, PxTransform) globalPose; if(actorType==PxActorType::eRIGID_STATIC) Cm::getStaticGlobalPoseAligned(static_cast<const Scb::RigidStatic&>(scbActor).getActor2World(), shape2Actor, globalPose); else { const Scb::Body& body = static_cast<const Scb::Body&>(scbActor); PX_ALIGN(16, PxTransform) kinematicTarget; PxU16 sqktFlags = PxRigidBodyFlag::eKINEMATIC|PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES; bool useTarget = (PxU16(body.getFlags()) & sqktFlags) == sqktFlags; const PxTransform& body2World = (useTarget && body.getKinematicTarget(kinematicTarget)) ? kinematicTarget : body.getBody2World(); Cm::getDynamicGlobalPoseAligned(body2World, shape2Actor, body.getBody2Actor(), globalPose); } return inflateBounds(geom.computeBounds(globalPose)); }