浏览代码

变身后会飞锁定刚体y轴

SZAND\msx_2 1 年之前
父节点
当前提交
8d1e4777b6
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      ActionTowerDefense/Assets/Scripts/PlayerController.cs

+ 5 - 0
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -1356,6 +1356,10 @@ public class PlayerController : MoveCharacter
         mesh = dem.mesh;
         mats = dem.mats;
         outlineMats = dem.outlineMats;
+        if (dem.canFly)
+        {
+            rb.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
+        }
         /*  ·¨Ê¦³ö³¡ÊͷŸ¡¿Õ³¡
         if (id == 3)
         {
@@ -1375,6 +1379,7 @@ public class PlayerController : MoveCharacter
 
     public void EndTransfiguration(int id)
     {
+        rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
         isTransfiguration = false;
         mecanim = playerMe;
         ani = playerAni;