 |
|
|
|
|
 |
|
|
Guest
|
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
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
Guest
|

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.
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 Δ).
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:
√(Vi²+2ad)
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
|
|
|
|
|
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.
|
|
|
|
|
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.
|
|
|
|
|
Senior Member
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
|

04-05-2010, 12:22 PM
both equations are essentially the same. They just use a different 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.
|
|
|
|
|
Senior Member
Status: Offline
Posts: 361
Join Date: Jun 2007
|

04-05-2010, 03:52 PM
Um, for people who are not that good with math, the way I did it was I told the game that while up is held, a variable (Well call it speed) increases from 0 (Nothing duh) to say 100 in like 5 seconds and when you let go of the button, it goes back to zero slowly. Then, in the events, I have an event that basically reads the variable and adjusts the speed accordingly.
For example:
While (Variable=between 0 and 20) is true, car move at speed 5 meters per second
While (Variable=between 21 and 40) is true, car move at speed 10 meters per second
Etc.
Of course there is an easier and more efficient way to do that, I just haven't played around with it enough to make sure that what I am thinking of right now works. Pretty sure it could but I'll have to test it out when I get home. That is just how I used to do it.
I am nowhere and everywhere at the same time.
www.facebook.com/chris101b
Xbox Live GT: Chris101b
Youtube: (You guessed it) www.youtube.com/chris101b
|
|
|
|
|
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.
|
|
|
|
|
Senior Member
Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
|

04-06-2010, 08:10 PM
Quote:
Originally Posted by Chris101b
Um, for people who are not that good with math, the way I did it was I told the game that while up is held, a variable (Well call it speed) increases from 0 (Nothing duh) to say 100 in like 5 seconds and when you let go of the button, it goes back to zero slowly. Then, in the events, I have an event that basically reads the variable and adjusts the speed accordingly.
For example:
While (Variable=between 0 and 20) is true, car move at speed 5 meters per second
While (Variable=between 21 and 40) is true, car move at speed 10 meters per second
Etc.
Of course there is an easier and more efficient way to do that, I just haven't played around with it enough to make sure that what I am thinking of right now works. Pretty sure it could but I'll have to test it out when I get home. That is just how I used to do it.
|
Of course there is an easier way Chris. All you have to do is this, have two variables.
If Car Speed <= Max Speed
Car Speed increment value by 1
_____________________________________________
While the world is running car move at speed Car Speed
I'm a web developer/ designer now.
|
|
|
Thread Tools |
|
Display Modes |
Linear 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
HTML code is Off
|
|
|
Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.
|
 |