[unity菜鸟] controller.SimpleMove(transform .forward); 无法移动

时间:2023-01-25 05:37:49

今天做demo时遇到一个问题:当使用角色控制器操作物体,用 controller.SimpleMove(transform .forward); 语句时物体不能移动,搜索请教了很久,最后终于google到了问题的根本原因。参见unity3d问答

      I suspect you may have some object with a collider childed to your character - the charactercontroller behaves weirdly when some child collider touches its capsule: it "thinks" to be colliding with its own child and moves to weird directions. If you have such object, set its collider Is Trigger field, and the character will ignore it.
      我怀疑你的一些对象可能有带“Collider"的子物体 - 当一些子物体的“Collider”触碰到角色控制器的胶囊体时,角色控制器会表现得很古怪:它“认为”与子物体相撞是移动到了错误的方向。如果你遇到这样的情形,把子物体Collider里的Is Trigger勾选上,那么角色就会忽略掉碰撞

经过翻译理解后,我把Is Trigger勾选 (或者当子物体没有用时可以把子物体删掉),问题才得到解决。

[unity菜鸟] controller.SimpleMove(transform .forward); 无法移动

子物体把父物体挡住了