in Ursina i am trying to make a simple 3d car game with FirstPersonController, how do i make the player/car rotate using 'a' and 'd' keys, without using the mouse. turn like a car would when you turn a corner in real life the view moves with the turn
how do i make a car in Ursina firstpersoncontroller rotate using the 'a' and 'd' keys, not the mouse
Asked
Active
Viewed 99 times
0
-
Please provide enough code so others can better understand or reproduce the problem. – Community Jun 23 '22 at 19:05
-
**disable** mouse for `FirstPersonController` and in `update` function check for key inputs and increase or decrease `rotation_y` according to the keys. – Tanay Jun 25 '22 at 10:59
1 Answers
1
After line
def update():
Try to add following lines:
if held_keys['d']: # If d is pressed
car.rotation_y += time.dt * 5 # turn car right
camera.rotation_y += time.dt * 5 # turn camera right
if held_keys['a']: # If a is pressed
camera.rotation_y -= time.dt * 5 # turn camera left
car.rotation_y -= time.dt * 5 # turn car left

EMILIO
- 267
- 1
- 2
- 8