ISceneNodes appearing at origin on creation
ISceneNodes appearing at origin on creation
I have an annoying problem where every time I create a new ISceneNode it appears at the origin for one frame before it moves to its correct location. I'm creating the nodes and setting their positions outside of the main loop (i.e. after driver->endScene() and before driver->beginScene()), but it does the same thing even if I do those functions in the middle of the main loop. I'd post a code snippet, but at this point my code is huge and I have no idea where the problem could be occurring. Does anyone have any general suggestions on this?
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
The child scene node should have a correct position immediately after construction because the constructor calls ISceneNode::updateAbsolutePosition(). If you call ISceneNode::setParent(), ISceneNode::addChild(), or ISeceneNode::setPosition() after construction then you will have to call ISceneNode::updateAbsolutePosition() or wait for an ISceneNode::OnPostRender() to get the actual position.
I modified the mesh viewer example...
And it printed x=10.000000 y=10.000000 z=10.000000 as expected.
Travis
I modified the mesh viewer example...
Code: Select all
Model = Device->getSceneManager()->addAnimatedMeshSceneNode(Mesh, 0, -1, core::vector3df(10.f, 10.f, 10.f));
core::vector3df pos = Model->getPosition();
fprintf(stderr, "x=%f y=%f z=%f\n", pos.X, pos.Y, pos.Z);
Travis