[osg-users] Getting model's direction vector from MatrixTransform?
umituzun84 at gmail.com
Mon Mar 30 06:30:05 PDT 2009
Thanks for your reply. I have tried your suggestion but there is some wierd.
carDirection = carWorldMatrix * osg::Vec3d(1.0, 0.0, 0.0);
This code gives me the direction vector, but vector gives me the mirrored
direction by the x axis. I mean when I rotate my car 45 degrees around the Z
up, given direction vector as -45 degrees rotated around the Z. So I get the
2009/3/30 Paul Martz <pmartz at skew-matrix.com>
> The upper left 3x3 of the local to world matrix is the orthonormal basis
> for the current orientation of the car. If the car is modeled so that the
> front of the car is positive X, then the current direction vector is just
> the first three elements of the local to world matrix. You can get the local
> to world matrix from the MatrixTransform.
> Paul Martz
> *Skew Matrix Software LLC*
> +1 303 859 9466
> *From:* osg-users-bounces at lists.openscenegraph.org [mailto:
> osg-users-bounces at lists.openscenegraph.org] *On Behalf Of *Ümit Uzun
> *Sent:* Sunday, March 29, 2009 3:45 PM
> *To:* OpenSceneGraph Users
> *Subject:* [osg-users] Getting model's direction vector from
> Hi All,
> I have an simple math question which I had resolved before but now I can't
> figure out what would be the problem. I have car model which's direction is
> x coordinate. I want to translate it by using it's current direction. So I
> need to know it's next visit coordinate while it is rotating to left or
> right. So this is my math;
> osg::Vec3d carDirection = quad * osg::Vec3d(1.0, 0.0, 0.0); // getting
> car's x direction vector.
> Then using carDirection, I calculate each next related coordinates
> respectively by using iterator.
> osg::Vec3d DestinationPos, SourcePos;
> DestinationPos = SourcePos + carDirection * iterator; (iterator >= 0)
> Do you think it is wrong?
> Best Regards.
> Ümit Uzun
> osg-users mailing list
> osg-users at lists.openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users