简体   繁体   English

使用实体锁定 Ursina 中的玩家 position

[英]Locking player position in Ursina with an Entity

  • How can I lock the position of my FirstPersonController in Ursina如何在 Ursina 中锁定我的FirstPersonController的 position

  • When my FirstPersonController remains standing, another Entity can go through the FirstPersonController entity though I used collider.当我的FirstPersonController保持站立时,另一个实体可以通过FirstPersonController实体 go 尽管我使用了对撞机。 How can I solve that?我该如何解决?

  • What exactly do you mean by "locking"? “锁定”到底是什么意思? You can disable a controller with your_controller.enabled = False saying your_controller is a FirstPersonController .您可以使用your_controller.enabled = False禁用 controller 说your_controllerFirstPersonController
  • A collider is not a wall, it's just something that can interact with raycasts . collider 不是墙,它只是可以与raycasts交互的东西。 If you want collision, you must shoot a raycast .如果你想要碰撞,你必须拍摄raycast If it hits something (an Entity with a collider ), check if the distance() between the Entity and the origin of the raycast is below a certain level.如果它撞到某物(带有colliderEntity ),请检查Entityraycast原点之间的distance()是否低于特定水平。 Just do something according to the result, like disabling the Entity .只需根据结果做一些事情,比如禁用Entity I'd recommend looking at FirstPersonController 's code and globally at samples on the Ursina repository.我建议查看FirstPersonController的代码并全局查看Ursina存储库中的示例。

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

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