Movement Python Script

Hey everyone.

This is probebly an extreamely easy question for people who are experts at python, but i have wrote a script to make my character move.
The problem is that when i press the left and right buttons it doesnt rotate the object, it just moves along an axis.

My question is, what is the code to make my object rotate?

Here is he code i used:

cont = GameLogic.getCurrentController()

forward = cont.sensors[‘up’]
backward = cont.sensors[‘down’]
left = cont.sensors[‘left’]
right = cont.sensors[‘right’]

move = cont.actuators[‘move’]

speed = [0,0,0]

if forward.positive:
speed[1] = 0.2

elif backward.positive:
speed[1] = -0.2

elif left.positive:
speed[0] = 0.2

elif right.positive:
speed[0] = -0.2

move.useLocalDLoc = True
move.dLoc = speed

cont.activate(move)

cont = GameLogic.getCurrentController()
 
forward = cont.sensors['up']
backward = cont.sensors['down']
left = cont.sensors['left']
right = cont.sensors['right']
 
move = cont.actuators['move']
 
movespeed = [0, 0, 0]
turnspeed = [0, 0, 0]
 
if forward.positive:
movespeed[1] = 0.2
 
elif backward.positive:
movespeed[1] = -0.2
 
elif left.positive:
turnspeed[2] = 0.2
 
elif right.positive:
turnspeed[2] = -0.2
 
move.useLocalDLoc = True
move.dLoc = movespeed
move.useLocalDRot = True
move.dRot = turnspeed
 
cont.activate(move)         

That should work :slight_smile:
DLoc changes the location of the object,
DRot changes the orientation of the object.

To move and turn at the same time, just change the "elif"s into "if"s

thanks dude, that works just fine :smiley: