平面對象位置到平面遊戲對象位置。平面對象位置到平面遊戲對象位置
基本上我基於三點創建了一架飛機。但是,出於測試的原因,我需要知道飛機在哪裏。所以,我的Hierarchy中有一個Plane GameObject(帶有網格,紋理和其他所有東西)。我想將平面遊戲對象移動到平面對象的位置和法線上。
下面是一些代碼:
plane1Go = GameObject.Find("Plane1");
Plane plane1 = new Plane(Point1,Point2,Point3);
plane1Go.gameObject.GetComponent<Mesh>().vertices= new Vector3[4]{Point1,Point2,Point3,Point4};
正如你可以看到我用三個點,用來做面對象移動的遊戲對象平面。
首先,Plane GameObject不動,我不知道爲什麼。
其次更重要的是,我想使用Plane對象實際上成爲Plane GameObject的參考點。
我的代碼可能會引起誤解。我對移動遊戲對象的網格物體並不感興趣,但對整個對象本身並不感興趣。另外,不要強加,但對於第二個問題你有什麼想法? – user3795555