i have a parent node translated from its 0,0,0...then i have a child of this node translated again from its 0,0,0...now, when i create the geometry for this node, i set its position using the _getDerivedPosition() of the node...i suppose the body gets its position from the geometry is tide to...but the body sets the position of its parent node using setPosition() .. so my geometry always appears translated with the parent's translation value!
i'm doing something wrong but i dont know what!
OgreODE question regardin body and geometry!
-
- OGRE Expert User
- Posts: 1422
- Joined: Sat May 22, 2004 5:28 am
- Location: Bucharest
- x 8
-
- OGRE Expert User
- Posts: 1422
- Joined: Sat May 22, 2004 5:28 am
- Location: Bucharest
- x 8
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
-
- OGRE Expert User
- Posts: 1422
- Joined: Sat May 22, 2004 5:28 am
- Location: Bucharest
- x 8
-
- OGRE Expert User
- Posts: 1422
- Joined: Sat May 22, 2004 5:28 am
- Location: Bucharest
- x 8
well, it doesnt work!
i'm under the impression i overcomplicate this!
the situation is like this: i have a parent node, and many child nodes, each having a body attached...i need to be able to move the parent node anywhere and keep the entire child arangement as it is!
is this something for which i need a TransformGeometry?
i'm under the impression i overcomplicate this!
the situation is like this: i have a parent node, and many child nodes, each having a body attached...i need to be able to move the parent node anywhere and keep the entire child arangement as it is!
is this something for which i need a TransformGeometry?
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
No, I don't think so. I didn't quite understand what you meant, sorry for the confusion. I if understand correctly, you want to just move the parent scene node and all the children should automatically move with it? Or do you want to move the parent scene node while the children should stay the same place in world space?eugen wrote:is this something for which i need a TransformGeometry?
-
- OGRE Expert User
- Posts: 1422
- Joined: Sat May 22, 2004 5:28 am
- Location: Bucharest
- x 8
-
- OGRE Expert User
- Posts: 1422
- Joined: Sat May 22, 2004 5:28 am
- Location: Bucharest
- x 8
when i use node->_getDerivedPosition() to set the geometry position, i get the geometry in the right position, but the visual representation of the node which has the body containing the geometry attaced, is translated with the parent's translation from 0,0,0...
when i use node->getPosition(), i get the geometry in the wrong position but the visual representation in the right one
now, in case of using the derived position, since the body uses setPosition() to sync the node with, seems that i cannot have the node in the same place, since its position will include the translation's parent node given at the geometry creation time. (this being a local setposition, i'll get it translated)
so it remains using setposition()... but like that, the geometry will not be in right place since it needs world coordinates!
i'm really curious, cause if this is a problem, someone must had spot it before me, for sure!
I incline to say i'm wrong somehow!
when i use node->getPosition(), i get the geometry in the wrong position but the visual representation in the right one
now, in case of using the derived position, since the body uses setPosition() to sync the node with, seems that i cannot have the node in the same place, since its position will include the translation's parent node given at the geometry creation time. (this being a local setposition, i'll get it translated)
so it remains using setposition()... but like that, the geometry will not be in right place since it needs world coordinates!
i'm really curious, cause if this is a problem, someone must had spot it before me, for sure!
I incline to say i'm wrong somehow!
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
The internal state of nodes are not updated immediately when you make changes to them. The reason is performance - if you were making a lot of changes to nodes in the scene graph, and we propagated all of those changes down the (potentially deep) tree immediately, lots of state would get needlessly updated because another change later on invalidates it.
Instead, we do a lazy update - this typically happens just before rendering but you can force it if you want to. That's what the _update method is about. Just only call it if absolutely, positively need to. You can usually get around the need to do so by synchronising all your node activity in one place, e.g. frameEnded.
Instead, we do a lazy update - this typically happens just before rendering but you can force it if you want to. That's what the _update method is about. Just only call it if absolutely, positively need to. You can usually get around the need to do so by synchronising all your node activity in one place, e.g. frameEnded.
-
- Kobold
- Posts: 27
- Joined: Thu Oct 21, 2004 12:32 pm
Could I ask a question about this just for some confirmation?sinbad wrote:You can usually get around the need to do so by synchronising all your node activity in one place, e.g. frameEnded.
I have a small test application that uses one framelistener. Eventually I want some basic AI dictating the positions of my entities etc. Would you say that the safest route to take is to use frameEnded to trigger all my update code, and not touch FrameStarted?
So basically I would leave FrameStarted blank, but in every frameEnded call I get my input (mouse and keyboard) go and ask my AI to calculate positions, I update my camera position, entity positions etc.
Is there any special order for these things to get best optimisation? Is there any updating that I really need to be doing in frameStarted at all?
-
- OGRE Expert User
- Posts: 1422
- Joined: Sat May 22, 2004 5:28 am
- Location: Bucharest
- x 8
i know about lasy updates...is not the problem here...i actually called root->_update(true, true) with no result...i get the node position as i should!
well, i have some questions to be answered (about OgreODE) :
1. does a static geometry needs world coordinates to be positioned in the right place? (for all i see it does)
2. does a body get its position from the geometry it implements? (if it does, then, calling body->setPosition to the attached node, will be a mistake, since setPosition sets local coordinates)
Thanx alot for replays!
If someone can aswer those! @Monster!?
i'm doint the things this way: create nodes structure, then, for each physical node, create the geometry, set its position (obtain pos from node->_getDerivedPosition()), then, for each dynamic geometry, create a body and attach it to the geometry.
well, i have some questions to be answered (about OgreODE) :
1. does a static geometry needs world coordinates to be positioned in the right place? (for all i see it does)
2. does a body get its position from the geometry it implements? (if it does, then, calling body->setPosition to the attached node, will be a mistake, since setPosition sets local coordinates)
Thanx alot for replays!
If someone can aswer those! @Monster!?
i'm doint the things this way: create nodes structure, then, for each physical node, create the geometry, set its position (obtain pos from node->_getDerivedPosition()), then, for each dynamic geometry, create a body and attach it to the geometry.
-
- OGRE Expert User
- Posts: 1422
- Joined: Sat May 22, 2004 5:28 am
- Location: Bucharest
- x 8