About Store Forum Documentation Contact
Donations:
243$/mo



Post Reply 
[Solved] Move Actor along direction
Author Message
xzessmedia Offline
Member

Post: #1
[Solved] Move Actor along direction
Hello there,
another question for me propably vector basics...

i want to add a velocity along the direction of an actor..
i studied the bloody massacre bullet code, but i want to use physics and add velocity into a direction.

the question is how can i use the matrix of my vector to multiply to my Force Vector or in other words,
i know i can use the matrix.z to move in the facing direction of obj.
how can i use my actors matrix to form a Force Vector into direction (i guess by multiplying it!?)

any tipps or ideas?

thank you very very much!
(This post was last modified: 06-13-2013 12:18 AM by xzessmedia.)
06-12-2013 10:38 PM
Find all posts by this user Quote this message in a reply
xzessmedia Offline
Member

Post: #2
RE: Move Actor along direction
well after some playing with values this seem to work...

Matrix m = actor.matrix().rotateY(45).normalize();
Vec ThrusterForce = Vec(0, 0, 5);
ThrusterForce += actor.pos();

ThrusterForce.mul(m);
ThrusterForce.normalize();
06-13-2013 12:17 AM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #3
RE: [Solved] Move Actor along direction
If you are using the physics system, a simpler solution:
Vec ThrusterForce ( 0, 0, speed );
ThrusterForce.mul( actor.orn( ) );
actor.addForce( ThrusterForce );

The orn(3x3) matrix holds the rotation, so you need only to multiply the force vector by the orn to get the right direction. If you have your object scaled, you will need to use the normalized(unscaled) orn instead.
06-13-2013 04:54 AM
Find all posts by this user Quote this message in a reply
xzessmedia Offline
Member

Post: #4
RE: [Solved] Move Actor along direction
Great!!
Thanks very much!
I will Test it later!
06-13-2013 12:00 PM
Find all posts by this user Quote this message in a reply
Post Reply