# Physics : how to script a constant acceleration

Please take a moment to consider if this thread is worth bumping.

## Recommended Posts

I have got an objet i want to move with a constant linear acceleration until to reach a maximum velocity

I know the function llGetAccel , but there is no function llSetAccel .

To move an object with a constant linear velocity i do generally a llMoveTotarget with a varaiable tau .And inside the event not_at_target , i call again llMoveTotarget with the same variable tau .

But for accelerations, it s ceratinly different.

How do you do ?

##### Share on other sites

llSetForce with a precalculated time until velocity reached

##### Share on other sites

Acheron Gloom wrote:

llSetForce with a precalculated time until velocity reached

Yes, F=m*a so a=F/m

Send a kind thought to Isaac Newton:smileyhappy:

##### Share on other sites

Math, loop and constantly redoing moveto might work? I don't use this, but am sort of interested in what you are talking about.

With vehicles physics in SL you can set the linear motors to take a time period to acheive the power you give them, and there is an efficiency to set as well. But, this is physics based and things like slope, weight, obstables, collisions (or lack of) and many other things efffect the speed at any given time and would effect the overall acceleration. YOu can use tight friction settings and many other changes to sort of reduce the effects of many things. But, still..linear is possibly not possible for you situation.

I am more interested in non linear acceleration lol. But, thought I would mention you can move an object with vehicle physics and not have to have a driver. Just set a timer and whatever trigger. The vehicle tutorial on the sl wiki might be of help, then again...maybe it isn't! lol.

##### Share on other sites

oh mygod .. Newton .. where was my head ? this apple has made maybe fall my memory :matte-motes-big-grin:

Thank you everybody for your answers . It s certainly the best idea to use llSetForce with llGetMass to move the item with a constant acceleration .

You have talked about a wiki on vehicles , but i is there a good wiki on physics ? I think more physics to use with industrial machines for instance ?

**edit* i ve tried to control my item as a vehicle even if it s not really a vehicle. it gives some interesting effects . And the code is simplified a lot of .. Nevertheless it s really unprecise , smooth, simple  but unprecise. I keep an eye above this , maybe it could be an option

##### Share on other sites

lolllllllllllllllllllll

##### Share on other sites

• 1 year later...

This topic really gave me hope that I might find what I'm looking for. :matte-motes-big-grin:

My question regarding acceleration is related to angular acceleration. I'm trying to create a script which enables a rod to rotate with constant angular acceleration (alpha) until it reaches some known angular velocity (omega) for a random period of time, and then starts decelerating to full stop.

Is the Idea of linear acceleration related somehow with angular acceleration in LSL? Can I, for example, apply a torque in order to use Newton's Law in rotary motion, as mentioned in previously?

##### Share on other sites

Does it really have to be physical, though?  If not, you can just do the math yourself and use keyframed motion to whatever granularity of "smooth" acceleration you want to achieve. (Well, theoretically, the granularity is at best one simulation frame -- 1/45 second--but that's as much granularity as Havok could ever compute--and several times as fast as anybody could perceive.)

I note that this is a very old thread -- if memory serves, there was no llSetKeyframedMotion() back then.

[ETA: To be complete, just in case this thing has to be physical, there is llApplyRotationalImpulse(). Can't say that I've ever used it myself, though.]