npc生成位置修复

This commit is contained in:
huyulong 2024-12-12 16:02:29 +08:00
parent 62c4d3a495
commit f9356cc0d4

View File

@ -492,8 +492,10 @@ public class test : MonoBehaviour
float x = -float.Parse(npcData.X.ToString());
float y = float.Parse(npcData.Y.ToString());
float z = float.Parse(npcData.Z.ToString());
trans.position = new Vector3(x, y, z);
GameObject.Instantiate(npc, trans);
Vector3 position = new Vector3(x, y, z);
// 使用指定的世界坐标位置来实例化 NPC而不是依赖 trans 位置
GameObject.Instantiate(npc, position, Quaternion.identity); // 直接指定位置和旋转
}
if(npcData.Type == 2)//npcÒƶ¯
{