简体   繁体   English

Ursina:更改 FirstPersonController 控件

[英]Ursina : change FirstPersonController controls

I'm trying to make a 3D game in Ursina.我正在尝试在 Ursina 中制作 3D 游戏。 I managed to have a working FirstPersonController, but it is using WASD.我设法拥有一个工作的 FirstPersonController,但它使用的是 WASD。 I'm french, and thus have an AZERTY keyboard, which isn't really convenient... Do you know how I could change my controls to move the FirstPersonController?我是法国人,因此有一个 AZERTY 键盘,这不是很方便......你知道我可以如何改变我的控件来移动 FirstPersonController 吗?

I'd also like to be able to use "special" buttons of my mouse.我还希望能够使用鼠标的“特殊”按钮。 For exemple, the "forward" and "backward" ones, to sprint and jump !例如,“前进”和“后退”,冲刺和跳跃!

You can either copy the code, which you're probably going to do if you need custom movement anyway, or you can rebind the keys with input_handler.rebind(to_key, from_key)您可以复制代码,如果您需要自定义移动,您可能会这样做,或者您可以使用input_handler.rebind(to_key, from_key)重新绑定键

The WSAD keys for movement are hard-coded in the FirstPersonController class' update() method.用于移动的 WSAD 键被硬编码在 FirstPersonController 类的update()方法中。 Overwriting that (by extending the class) didn't work for me so the easiest way would be running your own version of Ursina.覆盖它(通过扩展类)对我不起作用,所以最简单的方法是运行你自己的 Ursina 版本。 That is, don't install it through pip but clone the Git repo, edit the code and install it via python setup.py , as described in the documentation.也就是说,不要通过 pip 安装它,而是克隆 Git 存储库,编辑代码并通过python setup.py安装它,如文档中所述。

If you feel that this would be a useful feature, you could add an issue on Github .如果您觉得这将是一个有用的功能,您可以在 Github 上添加一个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM