Alice Community How to make a object move with a acceleration

 How to make a object move with a acceleration
 git_kid Guest   Status: Posts: n/a How to make a object move with a acceleration - 03-31-2010, 11:33 PM I want to make a racing project, but I don't know how to make cars move with accelerations. Please help, thanks very much
 jediaction Senior Member     Status: Offline Posts: 5,064 Join Date: Jul 2009 Location: Bel Air, Maryland 04-01-2010, 08:54 AM Um accelerations. Just make a car move forward normaly with 1 button, then make another button while its being held down the car moves forward again and it will double the speed if that one is faster than the other speed Website: www.salokingames.com FaceBook: www.facebook.com/SalokinGames
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 04-02-2010, 12:53 AM git_kid, do you know physics? If you do, you should be able to have the cars move according to the kinematic equation V^2 = Vo^2+2aX (X being delta X, of course). this allows you to have the car start slowly from zero and gradually work up to greater speeds (with the amount of speed gained increasing) as the key is held down. If you need a simpler explanation, let me know. (')>
Niteshifter
Guest

Status:
Posts: n/a
04-02-2010, 01:45 AM

Quote:
 Originally Posted by x2495iiii git_kid, do you know physics? If you do, you should be able to have the cars move according to the kinematic equation V^2 = Vo^2+2aX (X being delta X, of course). this allows you to have the car start slowly from zero and gradually work up to greater speeds (with the amount of speed gained increasing) as the key is held down. If you need a simpler explanation, let me know.
I'm not sure where you got that equation, but it's not entirely correct.

Where Vf is final velocity, Vi is the initial velocity, a is acceleration and d is distance (equation isn't supposed to include Δ).

A "while key is pressed" event can be used with a method telling the car to move at X speed, where X would be a function with the parameters 'd', 'a' and 'Vi' (Vi would need something to tell what the current speed of the car is) and would return the value of:

If you don't know advanced math symbols, then ignore the rest of this post, otherwise, use this equation as the parameter in the "move at speed X" and have it loop every second until the final distance is met:

d
∑(√(Vi²+2an))
n=0

d = distance travelled

 zonedabone Senior Member     Status: Offline Posts: 577 Join Date: Nov 2008 Location: In the interwebs 04-04-2010, 02:22 PM Just have the object move at speed x, a world variable, and then, when you want it to speed up, increase that variable. When you use lengths of time for variable changes, it does a smooth change. Just be sure to change the style to abruptly! 'Apple Macintosh' - An anagram of 'Complaints Heap' M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs. You're *such* a mac person.
 dubastot Senior Member     Status: Offline Posts: 661 Join Date: Apr 2009 Location: Two Steps From Hell 04-04-2010, 10:44 PM And don't forget to make another variable to limit your speed so the car doesn't move to fast. You will need an if/else statement for that. I'm a web developer/ designer now.
x2495iiii
Super Moderator

Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
04-06-2010, 09:53 AM

Quote:
 Originally Posted by Niteshifter It should be: Vf²=Vi²+2ad Where Vf is final velocity, Vi is the initial velocity, a is acceleration and d is distance (equation isn't supposed to include Δ).
Same equation, actually (though bravo on getting the delta to show up).

Delta X means the change in distance, so it is often worded as Delta x, not d (it was in my AP Physics textbook).

Same thing for the V's. V implicitly means final velocity, while Vo ("V aught"), means initial velocity.

In other words, my equation was just as correct as yours, just harder to read.

Quote:
 Originally Posted by reuben2011 Both equations are essentially the same. They just use different letters for the variables. In X's equation V is assumed to be Vf and Vo is assumed to be Vi ("0" as in zero/initial/beginning). X is better because you are looking for a displacement, not a distance (d). And of course it is delta X because it is the change in displacement. The delta is used just in case the initial X does not start at zero. I hope this clears some things up. Yes, I am taking a physics class this year.
Didn't think anyone would catch that but me, thanks reuben2011! Seems a shame to delete my nice response, though, so I'm keeping it.

(')>

Last edited by x2495iiii; 04-06-2010 at 09:57 AM.

Niteshifter
Guest

Status:
Posts: n/a
04-13-2010, 11:03 PM

Quote:
 Originally Posted by x2495iiii Same equation, actually (though bravo on getting the delta to show up). Delta X means the change in distance, so it is often worded as Delta x, not d (it was in my AP Physics textbook). Same thing for the V's. V implicitly means final velocity, while Vo ("V aught"), means initial velocity. In other words, my equation was just as correct as yours, just harder to read.
I'm too used to seeing displacement as a different character set which is why I messed that up (too close-minded of me ). Yours works better for explanation though. My sigma equation is essentially a result of too much calculus

 Thread Tools Display Modes Hybrid Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops     Alice Player and VR General Discussion     Questions and Comments     The Lounge