Heading, Facing direction, Quaternions, 3x3matrix.
3 posters
Heading, Facing direction, Quaternions, 3x3matrix.
How do I get the SIO2object's orientation?
Can I get the orientation of an object in quaternions.
How do you get the facing vector of an object in world space?
Do you represent the objects orientation with quaternions or 3x3 matrix
I am asking these because I could not find the API.
Sorry for all these questions but i could not find any examples.
Can I get the orientation of an object in quaternions.
How do you get the facing vector of an object in world space?
Do you represent the objects orientation with quaternions or 3x3 matrix
I am asking these because I could not find the API.
Sorry for all these questions but i could not find any examples.
evrenbingol- Posts : 7
Join date : 2009-07-12
Re: Heading, Facing direction, Quaternions, 3x3matrix.
The orientation is a vec3 of x, y, and z axis rotations, sadly sio2 doesn't seem to run axis-angle => quaternion => axis-angle type rotations. If you want to keep track of the up and right vectors, you have to multiply them by rotation factors. You can't use the matrix kept within the object because it holds its entire transformation, ie. scaling and translations included. Pretty much you have to do some extra work and cover yourself for a gimbal lock.
As for access, you can get to the transformation object (SIO2transform) from the object with these commands:
//location
<object pointer name>->_SIO2transform->loc->x
<object pointer name>->_SIO2transform->loc->y
<object pointer name>->_SIO2transform->loc->z
//rotation
<object pointer name>->_SIO2transform->rot->x
<object pointer name>->_SIO2transform->rot->y
<object pointer name>->_SIO2transform->rot->z
//direction
<object pointer name>->_SIO2transform->dir->x
<object pointer name>->_SIO2transform->dir->y
<object pointer name>->_SIO2transform->dir->z
loc, dir, and rot are all vec3's so you can simply get there address if you want to as well.
As for the math, http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html shows how you could transform those coordinates yourself.
As for access, you can get to the transformation object (SIO2transform) from the object with these commands:
//location
<object pointer name>->_SIO2transform->loc->x
<object pointer name>->_SIO2transform->loc->y
<object pointer name>->_SIO2transform->loc->z
//rotation
<object pointer name>->_SIO2transform->rot->x
<object pointer name>->_SIO2transform->rot->y
<object pointer name>->_SIO2transform->rot->z
//direction
<object pointer name>->_SIO2transform->dir->x
<object pointer name>->_SIO2transform->dir->y
<object pointer name>->_SIO2transform->dir->z
loc, dir, and rot are all vec3's so you can simply get there address if you want to as well.
As for the math, http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html shows how you could transform those coordinates yourself.
SuperDave- Posts : 7
Join date : 2009-06-28
Depends on implementation...
If you're using Bullet SDK (btrigibody etc), you can access that stuff from (object->_btRigidbody->...)
For a simple rotation info:
For a simple rotation info:
- Code:
btTransform tf = object->_btRigidbody->getWorldtransform(); //Get all object transformations and info
btQuaternion qt = tf.getRotation(); //You get the quaternion here
qt.getAngle(); // This is your rotation amount
qt.getAxis(); //This is the axis, rotation happens around
//*refer to bullet documentation for modifying the quaternion... (pretty straight forward)
//*don't forget to restore everything back to object world transform (if you made any changes)
tf.setRotation(qt);
object->_btRigidBody->setWorldTransform(tf);
goldfrapp0x0309- Posts : 43
Join date : 2009-02-28
Thanks You
Thank You all for the fast reply(s).
I know the math to do all that busy work. I though maybe I could access those stuff from the "_object", say like ogre.
As for the physics I don't think i ll use it since I have bunch of animated characters. And I don't wanna slow things down.
But thanks.
I know the math to do all that busy work. I though maybe I could access those stuff from the "_object", say like ogre.
As for the physics I don't think i ll use it since I have bunch of animated characters. And I don't wanna slow things down.
But thanks.
evrenbingol- Posts : 7
Join date : 2009-07-12
Similar topics
» move by direction
» How to set particle direction ?
» Lights direction and intensity problem
» How to set an object in the opposite direction movement?
» calculate an angle rotation from a direction vector
» How to set particle direction ?
» Lights direction and intensity problem
» How to set an object in the opposite direction movement?
» calculate an angle rotation from a direction vector
Permissions in this forum:
You cannot reply to topics in this forum