我正在尝试与 ursina 制作一款角色扮演游戏。我想让摄像机始终跟随角色的背部。我尝试使用camera.look_at(player),但在旋转时无法让相机旋转到角色的背面。
app = Ursina()
class character(Entity):
def __init__(self):
super().__init__(
model = load_model('cube'),
color = color.red,
position = (-0, -3, -8)
)
player = character()
print(player.forward)
print(player.forward)
camera.look_at(player)
player.rotation_y =180
def update():
if held_keys['a']:
player.rotation_y -= 2
if held_keys['d']:
player.rotation_y += 2
app.run()```
Run Code Online (Sandbox Code Playgroud)