Notifications
Clear all

[Closed] Calculating acceleration

Hi

Im doing a technical animation where i need object A to accelerate by a certain percentage of object B’s speed

so i need to calculate object B’s speed B_sp ( for the y-axis ) each time a frame has passed and then move objA like 0.5*B_sp

Im having difficulties finding the “event” that allows me to continually calculate the speed throughout the timeline.

how do i extract position values at every 2nd frame to calculate the speed, i thinks thats my mainproblem.

br

Kedde

17 Replies

You can get an object’s velocity at a time t by:


(at time t obj.pos) - (at time (t-1) obj.pos)

“at time” is the MXS context you use to get an object’s property at a specific time.

1 Reply
 eek
(@eek)
Joined: 11 months ago

Posts: 0

Thats the vector of movement, i.e its direction not its velocity. For velocity = the derivative distance/time is needed.

velocity =#()
dist= 0

for f = 1 to 100 do
(
slidertime = f
t1 = at time slidertime obj.pos
t2 = at time (slidertime – 1) obj.pos

dist += distance t1 t2

append velocity (dist/slidertime)

)

you now have slices of velocities at different time i.e the function of the derivative: f(dv/dt)

 AJ1

Now maths tends to make my brain catch fire so bear with me, but I’m a little confused…

From my poor memories of physics, d3coy’s method does produce the velocity – the speed & direction… And eek’s method is exactly the same but storing the value of each frame into an array…

Have I missed something?

Warning : I am quite retarded

 PEN

What james did retrieved the vector not the velocity. Velocity is a float value representing the distance from one vector to another. What james calcualted was the non normalized direction vector. Eek has the right formula.

 AJ1

I think I understand. I was moving an object along only one axis & looking at the values spat back…

As I said, maths is not my strong point!

Thanks Paul

Thx alot – havent had time to test out your suggestions – but Im quite sure they will help me do the job.

br

Kedde

Ahhh I dunno guys. In 3-space, velocity is a vector quantity, just as acceleration is also a vector. Velocity is both a speed and a direction – the speed is the vector length.

Subtracting a position at time t-1 from a position at time t gives the rate of change from t-1 to t. Velocity is dp/dt, or position over time – not dv/dt (velocity over time), which is acceleration. The derivitive of a position function at time t is the velocity at time t, and the derivitive is calculated by change in position/change in time. In the case I used, the position changed by the amount from t-1 to t, and the time step was 1.

Velocity is calculated implicitly like this all the time in dynamical systems that use Verlet Integration.

1 Reply
 eek
(@eek)
Joined: 11 months ago

Posts: 0

http://www.mansfieldct.org/schools/mms/staff/hand/lawsavevelocity2003.htm
http://library.thinkquest.org/C0110840/velocity.htm
http://www.kktechnology.com/help/x1080.html
http://en.wikipedia.org/wiki/Acceleration
http://en.wikipedia.org/wiki/Vector_%28spatial%29

Subtracting t-1 from t just gives a vector or direction about the origin, and not the derivative of the function over time. Acceleration is the function of velocity over time. Dont think of velocity as a vector, think of it as direction with a magnitude. Simply put, velocity is displacement per unit of time.

But a vector is a direction and a magnitude, is it not? From Wikipedia:

In physics, velocity is defined as the rate of change of position. It is a vector physical quantity, both speed and direction are required to define it.

http://en.wikipedia.org/wiki/Velocity

Of course subtracting two positions yields a vector situated at the origin, but I think this is exactly what we want. To integrate velocity, you add the change in acceleration multiplied by your time step, or: Velocity = v + dat. Likewise position is integrated by: Position = p + dvt. In our case, the change in position from t-1 to t represents exactly one integration of position. In other words, the only possible way to get from t-1 to t is to add the velocity vector to t-1, since this represents exactly one integration step.

 eek

Velocity = v + da*t

Isnt this speed?

This is what the f(d/t) essentially is – i think your just extrapolating parts of the same function. were both looking at the same answer just from different angles.

I think so too, haha. Thanks for going back and forth with me on this, eek.

I was always under the impression that speed is velocity? I just don’t know how to translate the term “speed” into a framework of physics.

Just so I don’t hijack this thread, I think that for the original poster’s problem, taking the vector between two positions is a good approximation. The vector between two positions is also a secant line between those positions, and calculus tells us that a secant line’s slope between two positions on a function represents the average rate of change between those two points. So the answer I supplied returns this value. Yours describes the rates of change at many different intervals. If you wanted an even closer approximation of velocity at a time t, you’d use floats in your at time context, giving you an even more accurate rate of change between these two positions, but you’d never get there since there are infinite gradations between two points.

So of course we want the derivative at time t on the position function, which is the instantaneous velocity at that time, and is also a tangential vector to the position function. My problem is that I have no idea how to find the derivative of the position function in 3ds Max! The standard way to get derivatives is with the difference quotient: f’(x) = (f(x + h) – f(x))/h

This is all well and good for two dimensional functions, but I just can’t wrap my head around extending this to the problem at hand.

Page 1 / 2