Ageia get actor direction

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Ageia get actor direction

Post by Slaine »

Hi, I'm not sure if this is a hard problem or not but I've been trying to get the direction my PhysX car is pointing, the reason I want this is to set the rotation of a 2D representation of the 3D car's direction, I've tried Actor->getGlobalOriantationQuat().z but that does nothing.

Thanks.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You car just has a matrix representing its transformation, not a defined direction that it's facing in.

To find a direction vector you can take a unit vector of your car's initial direction (when you created it, say 1,0,0, facing towards +X) and then you multiply the vector by the car's transformation matrix to get its current direction it's facing.
Image Image Image
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Post by Slaine »

JP wrote:You car just has a matrix representing its transformation, not a defined direction that it's facing in.

To find a direction vector you can take a unit vector of your car's initial direction (when you created it, say 1,0,0, facing towards +X) and then you multiply the vector by the car's transformation matrix to get its current direction it's facing.
Ay? How do I do that, your explanation is a bit cryptic :? This bit was the most confusing.

Code: Select all

multiply the vector by the car's transformation matrix
:wink:
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

How's that cryptic? Do vector * matrix :p

i think that's the way it's done... in Irrlicht the matrices have a nice function called transformVect which may actually be different to a multiplication, not sure...

but you could look at the irrlicht source for transformVect if it doesn't work.
Image Image Image
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Post by Slaine »

JP wrote:How's that cryptic? Do vector * matrix :p

i think that's the way it's done... in Irrlicht the matrices have a nice function called transformVect which may actually be different to a multiplication, not sure...

but you could look at the irrlicht source for transformVect if it doesn't work.
Okay thanks I'll have a look, trouble is I'm not experienced with Quats, Matricies, Euler rotations etc., so I'm a bit baffled on how to extract the info :(
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You're gonna need to know about matrices for a lot of things in game programming, especially when combining physics engines with rendering so have a bit of a google for a tutorial. Matrices are very scary at first but they're not particularly complicated and all the bits that are are generally hidden away from you by engines so you just have to use a function to extract the required info from the matrix rather than accessing the matrices elements to do it yourself :)
Image Image Image
Post Reply