I am trying to find the velocity of an actor in vector form, is this possible? I looked at linear velocity, but I need it in a vector and with the X and Y.
Comments
SlickZeroHouston, TexasMember, Sous ChefPosts: 2,870
You would need to make 2 real attributes, and constrain one to the X position of the actor, and another with the Y position. Then, drop 2 blank actors onscreen, and use a display text behavior. In one have it it say "Display Text > attribute.position X" and the same for the other, but use Y. This will display the actors current X and Y positions as it moves across the screen.
For the velocity, you do basically the same thing using the actors linear velocity X and linear velocity Y. And use a display text behavior set to show those particular attributes.
If SlickZero's answer isn't what you are looking for -- then I think you are going to need to give a little more detail about the output you are wanting. In a previous thread you indicated that you already know how to use vectorToAngle(velocity.x,velocity.y). What are you looking for, that is different from this?
If SlickZero's answer isn't what you are looking for -- then I think you are going to need to give a little more detail about the output you are wanting. In a previous thread you indicated that you already know how to use vectorToAngle(velocity.x,velocity.y). What are you looking for, that is different from this?
RThurman
What I am trying to do is get the velocity of the player and the velocity of an enemy in vector form and then subtract the two vectors. This is for a algorithm I found that allows AI to predict where an actor will end up and try to intercept the actor.
EDIT: I should just post the equation that I am trying to replicate. closing velocity = Vr prey velocity = Vprey predator velocity = Vpredator
Comments
For the velocity, you do basically the same thing using the actors linear velocity X and linear velocity Y. And use a display text behavior set to show those particular attributes.
RThurman
EDIT:
I should just post the equation that I am trying to replicate.
closing velocity = Vr
prey velocity = Vprey
predator velocity = Vpredator
Vr = Vprey - Vpredator
http://forums.gamesalad.com/discussion/comment/246593#Comment_246593
Hope this helps!
RThurman