byte_wrench
19-06-2007 21:17:01
Is is possible to generate a ccdskeleton for a sphere? If so, does anyone have any tips? - thank you
byte_wrench
19-06-2007 21:17:01
betajaen
19-06-2007 21:29:00
byte_wrench
19-06-2007 21:44:18
betajaen
19-06-2007 21:48:07
byte_wrench
19-06-2007 21:53:28
betajaen
19-06-2007 22:12:25
byte_wrench
20-06-2007 19:33:43
NxCCDSkeleton * createCCDfromActor ( NxActor * newActor )
{
assert(newActor->getNbShapes() == 1);
NxShape * const * grabShapes = newActor->getShapes();
// use a couple of casts to get the pointer I need
NxShape * grabShape = const_cast<NxShape *>(grabShapes[0]);
NxConvexShape * grabConvex = (NxConvexShape * )grabShape;
NxConvexMesh * grabMesh = & grabConvex->getConvexMesh();
// Turn the mesh into a descriptor to read the details
NxConvexMeshDesc meshDesc;
grabMesh->saveToDesc(meshDesc);
NxSimpleTriangleMesh stm;
stm.numVertices = meshDesc.numVertices;
stm.numTriangles = meshDesc.numTriangles;
stm.pointStrideBytes = sizeof(NxVec3);
stm.triangleStrideBytes = sizeof(NxU32) * 3;
stm.points = meshDesc.points;
stm.triangles = meshDesc.triangles;
stm.flags |= NX_MF_FLIPNORMALS; // if you need.
return mWorld->mPhysicsSDK->createCCDSkeleton(stm);
}
Aiursrage2k
21-06-2007 17:33:24
Limitations
64 vertex limit on CCD skeletons.
Skeletons limited to 256 edges.
Dynamic vs. static does not work when the static shape is an NxSphereShape, NxCapsuleShape, NxPlaneShape, etc. These shapes are not used for static geometry in many games and it would require significant work to support them since they are not polygon based shapes (the CCD algorithm works with meshes).
If the geometry of the static mesh is very complex and high detail (not common in a typical game), the dynamic object may get stuck on its surface after the collision due to conflicting contact points. Minimize this effect by reducing the penaltyZoneThickness, but depending on the mesh, it may not be fully resolved.
The dynamic vs. dynamic CCD uses an approximation which assumes one shape is rotating much faster than the other. If both shapes in a pair are rotating very quickly, the approximation may break down (causing unrealistic results).
The CCD code assumes shapes will not rotate by more than 180 degrees in a time step.
CCD works by limiting the motion of objects. When an interpenetration is detected, the objects are stopped dead, even if it is halfway through a time step. This may make objects appear to hang in mid air for one frame, etc.
Triggers do not take part in CCD.
Be very careful with assigning CCD skeletons only to some of a dynamic actor's shapes. There is the risk of a non-CCD shape penetrating another object before a CCD shape arrests the motion, leading to the actor getting stuck in penetration. Only create such actors if you can in some way insure that this will not occur.
Kinematic objects are never halted by CCD and so using CCD for fast-moving kinematic bodies has no effect. (This only applies when it's the kinematic object that is fast-moving, fast-moving dynamic CCD objects are halted by kinematic ones as usual.)
CCD does not work with restricted hardware scenes
byte_wrench
24-06-2007 01:31:55