s32 Player_Update(hENTITY ent) { plyr_pDat = (PlyrDat *)ent->m_usrDat; Vec3D zeroV(0,0,0); //update the movement _PlayerMoveNext(ent); _PlayerUpdateMove(ent); if(ent->m_vel == zeroV) { g_game.player->Move(PLYR_MOVE_IDLE); } return TRUE; }
bool InitNx() { // Initialize PhysicsSDK NxPhysicsSDKDesc desc; gMyPhysX.initPhysX(desc); if(isPhysXHardwarePresent()) printf("PhysX Hardware is available in your system!\n"); // Create a scene NxSceneDesc sceneDesc; sceneDesc.gravity = gDefaultGravity; gMyPhysX.createDefaultScene(sceneDesc); // Create ground plane NxPlaneShapeDesc PlaneDesc; PlaneDesc.group = 2; NxActorDesc ActorDesc; ActorDesc.shapes.pushBack(&PlaneDesc); gMyPhysX.getScene()->createActor(ActorDesc); NxMaterial * defaultMaterial = gMyPhysX.getScene()->getMaterialFromIndex(0); defaultMaterial->setRestitution(0.0f); defaultMaterial->setStaticFriction(0.5f); defaultMaterial->setDynamicFriction(0.5f); // Create trigger NxVec3 zeroV(0,0,0); CreateTrigger(NxVec3(0,10,0), 10); CreateTrigger(NxVec3(-40,10,0), 10, &zeroV, false); CreateCube(NxVec3(-40,10,40), 10, NULL, false, true); CreateCube(NxVec3(-40,10,80), 10, NULL, true, false); //This creates a kinematic actor with a trigger, note that kinematic //triggers get interactions with static objects, thus this trigger //(which is placed directly above the ground) will directly get an //enter event for the ground plane (and change it's color). CreateTrigger(NxVec3(40,10,0), 10, NULL, true); //You can try to move it up just a little bit, and you will see //that it will no longer intersect the ground plane. //CreateTrigger(NxVec3(40,11,0), 10, NULL, true); return true; }