jonmiller
10-07-2008 13:46:51
More problems with my ship here. The way I have it set up currently is that I load my ship and attach it to a child node of the root. Then I create a child node of the ship and attach to it my collidable geometry (lets call this console for now). Then I create an NxActor and set it's position to the center of console's WorldAABB. On startup this works, everything draws in the correct place. However, when I start translating my ship the faster I it goes, the more the actor seems to drift behind. If I'm at full speed it's off by about 4 feet or so, and half speed about 2 feet.
The way I'm translating the ship is just calling a translate on the ship's scene node by passing a unit z vector multiplied by ship speed multiplied by the seconds since last frame. Each frame that I update the ship I update the console actor (it's kinematic) by calling moveGlobalPosition(consoleSceneNode->getAttachedObject("console")->getWorldAABB().getCenter());
I've tried everything from getting the scene node's position, it's AABB center, World AABB center. I've also tried changing the order of when i translate vs when I update the physics. I'm not sure what is going wrong here. I've moved the world->simulate() function call to before and after I update my entire scene, but nothing seemed to change either. This is pretty confusing and frustrating because I feel like it should work and I've tried everything I can think of. Any advice? I'd appreciate it.
The way I'm translating the ship is just calling a translate on the ship's scene node by passing a unit z vector multiplied by ship speed multiplied by the seconds since last frame. Each frame that I update the ship I update the console actor (it's kinematic) by calling moveGlobalPosition(consoleSceneNode->getAttachedObject("console")->getWorldAABB().getCenter());
I've tried everything from getting the scene node's position, it's AABB center, World AABB center. I've also tried changing the order of when i translate vs when I update the physics. I'm not sure what is going wrong here. I've moved the world->simulate() function call to before and after I update my entire scene, but nothing seemed to change either. This is pretty confusing and frustrating because I feel like it should work and I've tried everything I can think of. Any advice? I'd appreciate it.