我的问题
我正在使用Panda3D
包装器Python
来运行一些第一人称游戏测试。我希望ursina
名为 的相机类型的FirstPersonController
对撞机将其对撞机扩展到精灵上。我已经尝试过(但并不知道如何使用,因为关于 Ursina 的教程并不多),BoxCollider()
但我并没有真正了解如何去做。谁能帮我?
我的代码
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
class Player(Entity):
def __init__(self, parent):
super().__init__( # super() is used to access things from the inheriting class (in this case the Entity class)
model = 'cube',
color = color.red,
parent = parent
)
class Floor(Entity):
def __init__(self):
super().__init__(
model = 'cube',
scale = (40, 3, 40),
color = color.rgb(23, 45, 105),
position = (0, -20, 0),
collider = 'box'
)
app = Ursina()
window.fps_counter.enabled = False
window.fullscreen = True
cam = FirstPersonController()
player = Player(cam)
floor = Floor()
def update():
if held_keys['escape']:
application.quit()
Sky()
app.run()
请帮忙,所有建议都有帮助!