Help with walkthrough, rotating

How do i change the navigation script to allow me to rotate the caracter with the left and right arrows, instead of moving it?

Thank you very much!!!

i’ll have to check this at home, try again next week [>] :o
i think then you’ll find the answer here

pat

I thank you very much!!
The code in the walkthrough it’s to much for me!!
Apreciated, alot! :smiley:

ok MADCello, here’s what i did:
i startet with a file called “walkthrough_template.blend” and Blender 2.34

i deleted the links from the keyboard sensors “leftkey” and “rightkey” to the “walk.py” controller and linked them to the “aim.py” controller instead
in the file “walk.py” i commented the lines

leftkey = cont.getSensor('leftkey')
rightkey = cont.getSensor('rightkey')

if rightkey.isPositive():
	vec = VEC_add(vec, playerX)

if leftkey.isPositive():
	vec = VEC_add(vec, VEC_mul(-1, playerX))

if you don’t do this your player will still move sidewards while rotating

second step: rotation
in the file “aim.py” i added some lines:

leftkey = cont.getSensor("leftkey")
rightkey = cont.getSensor("rightkey")

at the top before the first if-block and

elif leftkey.isPositive():
	playerrot = cont.getActuator('playerrot')
	player.rot += player.sensitivity
	GameLogic.addActiveActuator(playerrot, 1)

elif rightkey.isPositive():
	playerrot = cont.getActuator('playerrot')
	player.rot -= player.sensitivity
	GameLogic.addActiveActuator(playerrot, 1)

at the end of the file. i chose “player.sensitivity” as the rotation speed but you may change this as you like, using another property or a fixed number in the code

hope this helps

pat

You are 5 stars, pat!!
It works on perfection!!!

I just multiply 10 times the sensitivity for rotation, to speed it a bit!!

Once again, thank you very very very much!!! :smiley:

p.s. when you have time, (maybe in a week), you can check to see the result!!