Speed of moving vehicles

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Unspecified
Private
Posts: 6
Joined: Wed Jul 10, 2002 6:03 am

Speed of moving vehicles

Post by Unspecified »

So I've got the actual moving of vehicles down and working nicely...

...but does anyone know how to control the actual speed of the vehicle?
Nijnrich
Corporal
Posts: 28
Joined: Tue Oct 01, 2002 11:40 pm
Location: Eindhoven
Contact:

Post by Nijnrich »

How to set the speed :
this is just a bit from the excellent Tank tutorial of Kalahad. It mentioned somewhere on this site. I suggest you read it.

MoveTank:

First we need to define some local variables before we make the tank drive on the path. Here is what they mean:
local.Path: This is the path the tank is going to drive on.
local.TankSpeed: Duh, this is the speed of the tank.
local.Acceleration: The acceleration of the tank.
local.ReachDistance: This is the distance from the next waypoint. For example, here I put 200. This means that the tank will drive with same speed and acceleration on the path until it reaches a point 200 units before the next waypoint. Then the acceleration and speed will be ajusted to make the turn or a climb or ?
local.LookAhead: This is the point where the front of the tank will aim on the path. For example, here I put 64. This means that the front of the tank will aim at a point on the path that is 64 units in front of the tank. This help to have smoother turns on your path.
local.Path = $TankPanzer1_Path1
locall.TankSpeed = 7
local.Acceleration = 30
local.ReachDistance = 200
local.LookAhead = 64

Now we make the tank drive along the path with the help of the "drive" game class and the local variables we have just created. You do it like in the next script line where "self" is the tank and "drive" is the game class we use to make it run along the path.
self drive local.Path local.TankSpeed local.Acceleration

local.ReachDistance local.LookAhead
Post Reply