//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool PhysicsActor::attachBody(pCollisionShape_type _collision) { // valid Newton collision primitives include the following: // Null, Box, Sphere (ovoid), Cone, Capsule, Cylinder, ChamferCylinder, // ConvexHull (not impl yet), CompoundCollision (not impl), // TreeCollision (not impl yet), UserMesh (heightfield) m_pActor = NewtonCreateBody(dynamic_cast<PhysicsZone*>(m_pZone.get())->getZonePtr(), dynamic_cast<CollisionShape*>(_collision.get())->getShapePtr()); NewtonReleaseCollision(dynamic_cast<PhysicsZone*>(m_pZone.get())->getZonePtr(), dynamic_cast<CollisionShape*>(_collision.get())->getShapePtr()); // set the transform call back function NewtonBodySetTransformCallback(m_pActor, TransformCallback); NewtonBodySetForceAndTorqueCallback(m_pActor, ApplyForceAndTorqueCallback); NewtonBodySetAutoactiveCallback(m_pActor, ActivationStateCallback); //NewtonBodySetFreezeTreshold(m_pActor, NewtonBodySetUserData(m_pActor, this); return true; }
void Newtonnode::bodyActivationCallback(NewtonBodyActivationState callback) { NewtonBodySetAutoactiveCallback (m_pBody,callback); }