Acceleration script (working)
-
I decided to make this when I realised my new vehicle didn't feel heavy enough; I wanted it to be fast, but I didn't want instant acceleration and decceleration. This script deals with both problems, and you can adjust the acceleration and braking to your needs by changing the local variables at the top... well, here it is:
#Acceleration Script by Wacov accel=0.005 deccel=0.015 if frame==0; then; setVar("speed",0.5); end; if getVar("speed")>joyRY and getVar("speed")>0.5; setVar("speed",getVar("speed")-deccel); elsif getVar("speed")<joyRY and getVar("speed")<0.5; setVar("speed",getVar("speed")+deccel); end; if joyRY>0.5; then; setVar("speed",getVar("speed")+accel); end; if joyRY<0.5; then; setVar("speed",getVar("speed")-accel); end; if joyRY==0.5 and getVar("speed")<0.5; setVar("speed",getVar("speed")+deccel); elsif joyRY==0.5 and getVar("speed")>0.5; setVar("speed",getVar("speed")-deccel); end;
It will not accelerate beyond the input, so the overall speed is controllable. To change the control, change all the 'joyRY's to whatever you want.
To use, place in any onTick field. For a vehicle's motors, use:
0.5-getVar("speed")
In the motor's controler field. Hope this is useful!
Have at look at: http://sketchup.google.com/3dwarehouse/details?mid=9047719249a2da26cd8ad826e9017b8&prevstart=0 To see it at work.
-
Good, only thing is that when you hit something it doesn't slow you down. But it's very good.
-
So, you can control how fast it goes?
-
Nah, how fast it accelerates. Normal cars don't go from 0-120 in half a second; the script fixes that
-
I don't fully get it....
-
Very good! But please tell me how did you achieve such a good grip??
-
My method is quite complicated, but it revolves around a thruster pinning the car to the ground. Try putting -5000 in the thruster setting for the car's body (you might get some odd results, though)
Advertisement