FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Heading, Facing direction, Quaternions, 3x3matrix.

3 posters

Go down

Heading, Facing direction, Quaternions, 3x3matrix. Empty Heading, Facing direction, Quaternions, 3x3matrix.

Post  evrenbingol Sun Jul 12, 2009 4:54 am

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.

evrenbingol

Posts : 7
Join date : 2009-07-12

Back to top Go down

Heading, Facing direction, Quaternions, 3x3matrix. Empty Re: Heading, Facing direction, Quaternions, 3x3matrix.

Post  SuperDave Sun Jul 12, 2009 12:59 pm

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.

SuperDave

Posts : 7
Join date : 2009-06-28

Back to top Go down

Heading, Facing direction, Quaternions, 3x3matrix. Empty Depends on implementation...

Post  goldfrapp0x0309 Sun Jul 12, 2009 2:32 pm

If you're using Bullet SDK (btrigibody etc), you can access that stuff from (object->_btRigidbody->...)

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
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

Back to top Go down

Heading, Facing direction, Quaternions, 3x3matrix. Empty Thanks You

Post  evrenbingol Sun Jul 12, 2009 4:49 pm

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.

evrenbingol

Posts : 7
Join date : 2009-07-12

Back to top Go down

Heading, Facing direction, Quaternions, 3x3matrix. Empty Re: Heading, Facing direction, Quaternions, 3x3matrix.

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum