setOrientation of child Objects

Started by Dinin, May 19, 2012, 07:39:50 PM

Previous topic - Next topic

Dinin

Hi !

I'm trying to make a Object3D always facing away from Camera.
So i do:
object.SetOrientation(camera.getDirection(), camera.getUpVector())

this works fine, but when i add this object as child to a parentobject this doesn't work any more.

Any suggestions ?

thx and greeds
Dinin

EgonOlsen

Don't add it as a child then... ;) The setOrientation()-method works on the local rotation matrix of the object. It can't take the rotation of it's parents into account. What's the reason why you want to make this object a child of some other?

Dinin

#2
Because it should 'follow' this object.
So that the translations of the parentobject affect also this object and the child object remains exactly on this position 'on' the parentobject.

btw. is it possible to addChild without changing the translation of the childobject ?

EgonOlsen

In that case, you might want to ad your parent/child relation by hand in your own code. The way the engine does it, the complete transformations of the parent will be executed on the child. This doesn't seem to be what you want.