relative positioning to parent

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

relative positioning to parent

Post by instinct »

Hi all,

I have run into a problem and dont know how to solve it. Hope you can help me :)

Concretely speaking Im trying to position carton boxes on a pallet. This pallet has a parent, which is an empty scenenode with a 3D position. The boxes' their parent is the pallet. This way i only have to make sure i have to position the pallet correctly, the boxes will move along with the parent.

When im positioning the boxes, they do not appear 'on' the pallet but next to it. Im 90% sure i calculated the relative positions on the boxes correct, so my question to you is: Am i doing this parenting correct or am i doing something wrong?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

How could we tell if you do anything wrong or correct if you don't show the source in question? :-)

The only general information we can give is that Y is by default the vector value for height (unless you did some rotations).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

Post by instinct »

Basically this is the situation

Code: Select all

Pallet->setParent(an Empty SceneNode)
Box->setParent(Pallet)
Like i said im 90% sure my positioning code is correct. Am i correct by thinking the box will move along with the pallet when i do my parenting as described above?

For example: The pallet's Y coordinate is -37 relative to its parent. This is correct, i see the pallet on the floor. The box' position should be positive to its parent, since its placed on the pallet. However, debugging tells me it's -27. How does this happen? Im not sure, but it looks like the position is calculated relative to its parent's parent.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

So you are saying your box relative coordinates switch from positive to negative without you changing them in any way? That would be a bad bug - but I use empy scene nodes a lot and so far it's not a bug I've seen.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

Post by instinct »

thanks for pointing that out to me CuteAlien. Turned out i did and fixed the bug in my own code ;)!
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Mystery solved :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply