![](smile.gif)
Difference between the velocity and the magnitude
Is there one?
I use this formula to move an object in a game:
xpos += magnitude * cos(angle);
ypos += magnitude * sin(angle);
I wonder if I can take the magnitude variable as the velocity of my object. And then use this variable in other formula like acceleration, freely falling body, ...
Thanks for help
![](smile.gif)
You need to break down that magnitude into x and y components. Which is what you are doing with your two equations. You can then use those two values as the velocity in the other formulas because all the kinematics and other formulas are for motion in one direction. So you would have to calculate x accelaration and y separatly.
"...."
Ok then the answer is true, but I just have to break down my values with a structure like below:
Position.x += Magnitude.x * cos(angle);
Position.y += Magnitude.y * sin(angle);
Is it right?
Position.x += Magnitude.x * cos(angle);
Position.y += Magnitude.y * sin(angle);
Is it right?
okay, you''re confusing to very specific terms, velocity and SPEED. Velocity is very sepecifically a direction (which way are you going) and magnitude (how much are you going in that direction). Speed on the other hand is only the magnitude. So, the term "velocity vector" is redundant, and if you say "speed vector" you might as well say velocity.
More importantly, a body can only have one velocity at a time, but multiple speeds depending on what direction you are looking at. For example, if your velocity is 1 ft/sec at 45deg above the x axis in the xy plane, then your SPEED in the x direction is the square root of 1/2.
More importantly, a body can only have one velocity at a time, but multiple speeds depending on what direction you are looking at. For example, if your velocity is 1 ft/sec at 45deg above the x axis in the xy plane, then your SPEED in the x direction is the square root of 1/2.
[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]
Now let´s sort this out:
Velocity - The speed of the object...The magnitude of the momentum
Magnitude - The length of a vector
Heading - |Heading| = 1
Heading * Velocity = Momentum
Velocity - The speed of the object...The magnitude of the momentum
Magnitude - The length of a vector
Heading - |Heading| = 1
Heading * Velocity = Momentum
delete this;
I thought I'd add that the Magnitude.x factor should have already accounted for the angle of travel, so the cos(angle) bit is erroneous. Same with the Magnitude.y factor and sin(angle).
The length of your Magnitude vector is your velocity/speed.
so:
Speed = length(Magnitude);
Position.x += Magnitude.x;
Position.y += Magnitude.y;
Edited by - miles vignol on January 9, 2002 1:30:46 AM
The length of your Magnitude vector is your velocity/speed.
so:
Speed = length(Magnitude);
Position.x += Magnitude.x;
Position.y += Magnitude.y;
Edited by - miles vignol on January 9, 2002 1:30:46 AM
Velocity: magnitude & direction(angle);
Speed: Magnitude of velocity
direction: angle
Momentum: mass * velocity
to find the angle, take the tangent inverse of the quotient of your vectors Y component magnitude over your vectors X component magnitude.
to find the magnitude of a vector from it''s x and y (and z maybe) component magnidudes, take the add the squares of all these numbers together, and then take the square root.
Edem Attiogbe
Speed: Magnitude of velocity
direction: angle
Momentum: mass * velocity
to find the angle, take the tangent inverse of the quotient of your vectors Y component magnitude over your vectors X component magnitude.
to find the magnitude of a vector from it''s x and y (and z maybe) component magnidudes, take the add the squares of all these numbers together, and then take the square root.
Edem Attiogbe
Edem Attiogbe
the answer is Yes (or at least try it out), but you might have to consider the timeframe. You might want to scale the magnitude by the deltatime to fit a certain formula ...
this is just polar (dunno the right english term) coordinates.
xspeed = magnitude * cos(angle);
yspeed = magnitude * sin(angle);
there are some other considerations when dealing with acceleration that has to do with estimation errors and such - take a look at runge-kutta integration if your physics engine goes beserk ...
oh... - didn't see the second post. magnitude is a scalar variable in this case, an integer or float - NOT a vector.
Edited by - JOL on January 9, 2002 4:32:23 AM
this is just polar (dunno the right english term) coordinates.
xspeed = magnitude * cos(angle);
yspeed = magnitude * sin(angle);
there are some other considerations when dealing with acceleration that has to do with estimation errors and such - take a look at runge-kutta integration if your physics engine goes beserk ...
oh... - didn't see the second post. magnitude is a scalar variable in this case, an integer or float - NOT a vector.
Edited by - JOL on January 9, 2002 4:32:23 AM
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I'm looking for work
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement