Help with speed vectors

I have a velocity vector V (233, 188).

It moves the object towards the bottom right of the screen at 300 pixels per second when the source is V (0, 0).

When the position of the object is, for example, (592, 334), I set the velocity vector to V (294, 55), but the object does not start moving in that direction ... It keeps moving the same but it seems like it makes a little curve 10 degrees ...

What am I doing:

objectLocation += velocity * elapsedTime;

      

What am I doing wrong?

0


a source to share


1 answer


The difference between (233.188) and (294.55) is not that big, in the grand scheme of things. To test if your code works try a vector like (200, -200). This will cause it to actually bounce off the point in the y direction.



If this code works, then it's just your values ​​not working.

+1


a source







All Articles