Original Post
🔒 Locked
3D Vector Movement
Advertisement
Say your vector is {x, y, z}, and the speed you want is s.
Work out the vector magnitude, m.
Scale x, y and z by (s/m) to give a new vector, with components
{x *s/m, y * s/m, z * s/m}.
This is the vector, with the ''per-second components'' you want. It will also work for the per frame speed: just use the correct s (e.g. a speed of 50 units per second and 30 fps gives s = 50/30 units per frame).
Work out the vector magnitude, m.
Scale x, y and z by (s/m) to give a new vector, with components
{x *s/m, y * s/m, z * s/m}.
This is the vector, with the ''per-second components'' you want. It will also work for the per frame speed: just use the correct s (e.g. a speed of 50 units per second and 30 fps gives s = 50/30 units per frame).
Position(t) = Position(t=0) + velocity * t (assuming your velocity is constant).
EDIT: Oh, and if you have a speed and a direction to move, then scale your direction (given you have it as a vector) to the speed (50 in your example) and you have the velocity.
[edited by - Atheist on August 13, 2003 1:27:43 AM]
EDIT: Oh, and if you have a speed and a direction to move, then scale your direction (given you have it as a vector) to the speed (50 in your example) and you have the velocity.
[edited by - Atheist on August 13, 2003 1:27:43 AM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement