Hi Elias,

Seems like you are after a change of coordinate frame (e.g. which axis is front/up etc.)
From my experience: don't ...
What I usually do ist to transform at the interface by using a permutation matrix.
So for instance if you want
x = x´
y = -z
z = y

then multiply your incoming positions/orientation with the matrix
1  0  0  0
0  0 -1  0
0  1  0  0
0  0  0  1

and your outgoing with the inverse (or transpose in this case).

This saves you the trouble of fiddeling with the coordinates inside osg.

Cheers
Sebastian
Hello, Robert!
Thanks for the quick reply.
It seems i wasn't able to clarify my question. I dont use MatrixTransform or 
PositionAttitudeTransform here because i don't want to transform my target node 
relate to others. I want to change local XYZ in that node itself, not the 
position of my node relate to other nodes or world XYZ.

Let me describe more specifically.
Standart aerodynamic convention (and it also looks reasonable in most practical 
situations) defines local(body) coordinate system as:
O - center of mass (here just center of a node), X - from center up to nose, Y 
- from center up to right wing, Z - down. That leads to Roll, Pitch, Yaw 
rotations around X,Y,Z respectively.

Let say i want to place camera right behind cessna's tail. Then, AFAIK that 
code can help me

Code:

nodeTracker = new osgGA::NodeTrackerManipulator;
nodeTracker->setHomePosition( Vec3(-90,0,0), Vec3(), Z_AXIS );
nodeTracker->setTrackerMode(osgGA::NodeTrackerManipulator::NODE_CENTER_AND_ROTATION
 );
nodeTracker->setTrackNode( cessna.get() );




So: eye Vec3(-90,0,0) means 90 behind center on X. //Local coords, right?
And of course what we can see now is depended on how X is oriented with respect 
to model body.

If, for instance, X has center at model's center and go straight up to nose,
then -90 means right behind tail (this is what i want to achieve)

But if X has center at model's center and go from right wing, then -90 means we 
see left side of an aeroplane, not the tail.

Then, even when cessna moves correctly (for instance, straight to the north), i 
see at as moving with right wing forward and nose to the west.

Also, Roll (rotation about X axis) will be looking like pitch (rotation about Y 
axis according to aerodynamic standart)
So to avoid confusion and necessity to remeber how that particular node 
(cessna) is oriented with respect to its own local coords, maybe the better
way is to rotate local coords somehow?

I might be wrong, just to explain why i cannot use Tranform classes according 
to you advice.

Could you explain how that problem might be solved?

Thank you!

Cheers,
Elias

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64161#64161





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to