Original Post
Hello !
First, i am very happy to do my first post here !
Second, please forgive my bad english.
I should had study it more at school hehe...
Here is my problem,
i try to apply this nice tutorial to my game :
http://web.archive.org/web/20060220062712/http://home.planet.nl/~monstrous/tutcar.html
I have some problem about some values.
I don't understand what is the first u vector ?
For the line :
Ftraction = u * Engineforce,
Also, for the line :
a = F/M
is this F = Flong ?
Here is my code for at moment :
I run 30 fps.
I just want to care about straight line acceleration, so no .y values.
loop() function is called every 30fps.
Thank you for reading !
I hope i can get some help !
cia.
First, i am very happy to do my first post here !
Second, please forgive my bad english.
I should had study it more at school hehe...
Here is my problem,
i try to apply this nice tutorial to my game :
http://web.archive.org/web/20060220062712/http://home.planet.nl/~monstrous/tutcar.html
I have some problem about some values.
I don't understand what is the first u vector ?
For the line :
Ftraction = u * Engineforce,
Also, for the line :
a = F/M
is this F = Flong ?
Here is my code for at moment :
I run 30 fps.
I just want to care about straight line acceleration, so no .y values.
//===========================================// VARIABLES//===========================================private var engineForce:Number=1;private var Mass:Number=1000; private var FtractionX:Number=0;private var FlongX:Number=0;private var FdragX:Number=0;private var FrrX:Number=0; private var velocityX:Number=0;private var speedX:Number=0; private var accelerationX:Number=0;private var carPositionX:Number=0; private var Cdrag:Number=0.4257;private var Crr:Number=12.8;//===========================================// ADD FORCES//===========================================private function addForces():void { FtractionX = engineForce; speedX = Math.sqrt(velocityX * velocityX); FdragX = - (Cdrag * velocityX * speedX); FrrX = - (Crr * velocityX); FlongX = FtractionX + FdragX + FrrX; accelerationX = FlongX / Mass; velocityX = velocityX + (30 * accelerationX); carPositionX = carPositionX + (30 * velocityX);}//===========================================// LOOP//===========================================private function loop(e:Event):void { addForce(); car.x=carPositionX;}loop() function is called every 30fps.
Thank you for reading !
I hope i can get some help !
cia.