Author Topic: Angles to Vectors helpp!  (Read 1142 times)

Remove the %h line, replace the other part with mATan(%x/%y)
wait, like that?

return vectorScale(vectorNormalize(getWords(vectorSub(%pos1, %pos0), 0, 1)), %force);

Explanation: %pos0 is the position of the player to push away from, %pos1 is the position of the player to push, and %force is how much to push on him.


I prefer not swapping between types arbitrarily. Your code goes from Vector3D to Angle and back to Vector3D, whereas mine consistently uses Vector3D all the way through.

return vectorScale(vectorNormalize(getWords(vectorSub(%pos1, %pos0), 0, 1)), %force);

Explanation: %pos0 is the position of the player to push away from, %pos1 is the position of the player to push, and %force is how much to push on him.


I prefer not swapping between types arbitrarily. Your code goes from Vector3D to Angle and back to Vector3D, whereas mine consistently uses Vector3D all the way through.
I have a question: What does vectorNormalize do?

It scales the given vector to have a length of one.

wait, like that?
Yes like that. It should work, although I can't test it.

Yes like that. It should work, although I can't test it.
oh sweet thanks.

just a quick question on this topic
why is everybody using trig functions when you have all of the sides of the triangle already, and can just resize it?
it seems silly to use trig to find the angle, and then undo the trig with more trig

just a quick question on this topic
why is everybody using trig functions when you have all of the sides of the triangle already, and can just resize it?
it seems silly to use trig to find the angle, and then undo the trig with more trig

return vectorScale(vectorNormalize(getWords(vectorSub(%pos1, %pos0), 0, 1)), %force);