0

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

Tait Bunt
  • 1
  • 1
  • 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 Answers1

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