[英]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?我该如何解决?
your_controller.enabled = False
saying your_controller
is a FirstPersonController
.your_controller.enabled = False
禁用 controller 说your_controller
是FirstPersonController
。raycasts
. 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.collider
的Entity
),请检查Entity
与raycast
原点之间的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.