void80
26-07-2010 18:22:27
In my project I now have the strange occurence, that my model sometimes stops moving.
I have a simple example, where there is one body, which is the floor, and an entity, which shall be the player. The player starts some place over the floor, then starts to fall and lands on the floor. I get the collision callbacks and everything seems alright. But sometimes the geometry and scene node go out of sync. This happens in about 5% of the cases, with no appearent reason. it is totally random.
I have an entity, which is attached to a modelNode. This is the child of a playerNode. the playerNode is attached to the body.
The code looks something like this:
Whenever the Objects go out of sync I print out all the position vectors. The body has exactly the position I expect (which is on the floor after some time, resulting in getting the collision events), the playerNode having the same position. The model node always has the position ZERO, which I also expect.
Maybe the problem comes from the fact, that my rendering loop and my stepper and world->synchronize are in different threads. But I synchronized the calls to synchronize and the frameStarted/frameEnded events, so I think there is no problem there.
Does anybody have an idea where I should continue my search? I don't have the slightest idea, what I should check next.
I have a simple example, where there is one body, which is the floor, and an entity, which shall be the player. The player starts some place over the floor, then starts to fall and lands on the floor. I get the collision callbacks and everything seems alright. But sometimes the geometry and scene node go out of sync. This happens in about 5% of the cases, with no appearent reason. it is totally random.
I have an entity, which is attached to a modelNode. This is the child of a playerNode. the playerNode is attached to the body.
The code looks something like this:
m_entity = manager->createEntity("ninja.mesh");
m_playerNode = node->createChildSceneNode();
m_playerNode->setScale(0.01f, 0.01f, 0.01f);
Ogre::SceneNode *modelNode = m_playerNode->createChildSceneNode();
modelNode->setOrientation(Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Y));
modelNode->attachObject(m_entity);
m_playerNode->setPosition(m_body->getPosition());
m_playerNode->attachObject(m_body.get());
Whenever the Objects go out of sync I print out all the position vectors. The body has exactly the position I expect (which is on the floor after some time, resulting in getting the collision events), the playerNode having the same position. The model node always has the position ZERO, which I also expect.
Maybe the problem comes from the fact, that my rendering loop and my stepper and world->synchronize are in different threads. But I synchronized the calls to synchronize and the frameStarted/frameEnded events, so I think there is no problem there.
Does anybody have an idea where I should continue my search? I don't have the slightest idea, what I should check next.