xzessmedia
Member
|
Vector question
Hi there,
can anybody tell me how to get the bodies direction?
i have the desired speed which i applied on to the body.
works fine of course but using the z axis the force will always be on the absolute z axis. i want it to be relative so it always applies into the direction..
i guess i need to combine the actors matrix (direction) with the force vector !? but how can i do this?
thanks in advice!
|
|
02-13-2014 05:26 AM |
|
Rubeus
Member
|
RE: Vector question
Multiply the vector by the transformation matrix(matrix.orn I think it is). The vector will then be relative to the objects orientation.
|
|
02-13-2014 03:10 PM |
|
xzessmedia
Member
|
RE: Vector question
works perfect thank you rubeus!
Code:
Vec mf = Vec(0, 0, speed).mul(actor.matrix().orn());
actor.addVel(mf);
|
|
02-14-2014 12:10 PM |
|