turning


(snowy_duck) #1

okay on my gokart game i want it so u can only turn when your moving. if u have a

keyboard(forward)--------controller------------acuator
uparrow / and \ (forward motion)
keyboard(left)----------/ ---------actuator
leftarrow (rotate motion)

then u only turn when u gas it (u don’t punch-it on a turn)

keyboard(left)----------controller---------actuator
leftarrow (rotate motion)

then u turn when your stopped?


(ndnchief) #2

from GameLogic import *

SCRIPT PURPOSE:

to only allow steering if vehicle is

moving. Just checks velocities of the

vehicle and sets flag if you are moving…

VARIABLES REQUIRED ON CALLING OBJECT:

steer - flag whether to steer or not - INT

CALLING SENSOR REQUIRED:

you can use an always sensor.

ACTUATORS REQUIRED:

None.

SteerCont = getCurrentController()
SteerOwn = SteerCont.getOwner()

VelCheck = SteerOwn.getLinearVelocity()

VelTestX = abs(VelCheck[0])
VelTestY = abs(VelCheck[1])

if (VelTestX > 0):
SteerOwn.steer = 1

if (VelTestY >0):
SteerOwn.steer = 1

if (VelTestX < .05) and (VelTestY < .05):
SteerOwn.steer = 0

If you need a blend example email me and I will send it…

The NDN…