'How can I make the player go forward? (Ursina Python)
class Player(Entity):
def __init__(self):
self.controller = Entity(
model = 'cube',
parent = camera
)
super().__init__(parent=self.controller)
def update(self):
if held_keys['a']:
camera.rotation_y -= 50 * time.dt
self.controller.rotation_y = camera.rotation_y
if camera.rotation_y < -360: camera.rotation_y = 0
if held_keys['d']:
camera.rotation_y += 50 * time.dt
self.controller.rotation_y = camera.rotation_y
if camera.rotation_y > 360: camera.rotation_y = 0
Solution 1:[1]
entity = Entity(model='cube')
def update():
entity.position += entity.forward
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | pokepetter |
