MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / getShapeCenter

Function getShapeCenter

physx/samples/samplebase/RaycastCCD.cpp:45–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43//#define RAYCAST_CCD_PRINT_DEBUG
44
45PxVec3 getShapeCenter(PxRigidActor* actor, PxShape* shape, const PxVec3& localOffset)
46{
47 PxVec3 offset = localOffset;
48
49 switch(shape->getGeometryType())
50 {
51 case PxGeometryType::eCONVEXMESH:
52 {
53 PxConvexMeshGeometry geometry;
54 bool status = shape->getConvexMeshGeometry(geometry);
55 PX_UNUSED(status);
56 PX_ASSERT(status);
57
58 PxReal mass;
59 PxMat33 localInertia;
60 PxVec3 localCenterOfMass;
61 geometry.convexMesh->getMassInformation(mass, localInertia, localCenterOfMass);
62
63 offset += localCenterOfMass;
64 }
65 break;
66 default:
67 break;
68 }
69 const PxTransform pose = PxShapeExt::getGlobalPose(*shape, *actor);
70 return pose.transform(offset);
71}
72
73static PxReal computeInternalRadius(PxRigidActor* actor, PxShape* shape, const PxVec3& dir, /*PxVec3& offset,*/ const PxVec3& centerOffset)
74{

Callers 4

computeInternalRadiusFunction · 0.70
updateMethod · 0.70
setPhysicsShapeMethod · 0.70
drawDebugMethod · 0.70

Calls 5

PX_UNUSEDFunction · 0.85
getConvexMeshGeometryMethod · 0.80
getMassInformationMethod · 0.80
getGeometryTypeMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected