[osg-users] How to get the orientation of 3d object?

Alberto Luaces aluaces at udc.es
Wed Apr 12 07:53:10 PDT 2017

"Jiechang Guo" writes:

> Hi,
> I am dealing with a task of orienting and positioning one object
> relative to another(the same object as the manipulated one,but has
> different position and orientation). And when the task is finished, I
> wanna compute the deviation(both position and orienting). For the
> orientation, I want to get the angle and axis.
> I'm so confused with the Local coordinate and World coordinate in OSG. 
> I know maybe I should define a vector under the object local
> coordinate and rotate translate the vector as well as the object is
> being manipulated.And do some math with the vector under the world
> coordinate to get the angle and axis.
> Can someone give me some advice?

Hi Jiechang, if you want to place an object relative to other, just make
it as its child.  The positioning matrix of the second one will be the
information you are looking for.

After that, you can convert that matrix to a quaternion or whatever
representation you prefer.


More information about the osg-users mailing list