PhysX物理引擎(2)Collision
本文主要介绍PhysX碰撞检测的一些内部机制和使用方法。 PhysX物理引擎系列记录了在实际项目中使用Nvdia PhysX 3.4物理引擎(Code, Doc)的一些经验,有不少对官方资料的补充。 Warm-up Static, Kinematic & Dynamic Static colliders are non-movable. In fact, they are not rigidbody, just PxRigidStatic. Kinematic and dynamic rigidbody are both PxRigidDynamic, and can switch to each other at runtime by setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true/false). The biggest difference is that kinematic rigidbody behaves like infinite mass, and will not move by external force. Instead, you call MovePosition on it. Dynamic rigidbody is the only type we can AddForce to, which has mass, center of mass, and inertia tensor to simulate a natural movement with Newton’s laws of motion. classDiagram PxRigidActor <-- PxRigidStatic PxRigidActor <-- PxRigidBody PxRigidBody <-- PxRigidDynamic PxRigidActor *.. PxShape class PxRigidBody { PxRigidBodyFlag } class PxShape { PxShapeFlag } We cannot make a rigidbody without a shape. Shapes are tangible, with a real size. ...