npc生成位置修复
This commit is contained in:
parent
62c4d3a495
commit
f9356cc0d4
@ -492,8 +492,10 @@ public class test : MonoBehaviour
|
|||||||
float x = -float.Parse(npcData.X.ToString());
|
float x = -float.Parse(npcData.X.ToString());
|
||||||
float y = float.Parse(npcData.Y.ToString());
|
float y = float.Parse(npcData.Y.ToString());
|
||||||
float z = float.Parse(npcData.Z.ToString());
|
float z = float.Parse(npcData.Z.ToString());
|
||||||
trans.position = new Vector3(x, y, z);
|
Vector3 position = new Vector3(x, y, z);
|
||||||
GameObject.Instantiate(npc, trans);
|
|
||||||
|
// 使用指定的世界坐标位置来实例化 NPC,而不是依赖 trans 位置
|
||||||
|
GameObject.Instantiate(npc, position, Quaternion.identity); // 直接指定位置和旋转
|
||||||
}
|
}
|
||||||
if(npcData.Type == 2)//npcÒÆ¶¯
|
if(npcData.Type == 2)//npcÒÆ¶¯
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user