set()
方法用于设置飞机的位置和旋转角度。
plane.set(position, rotation);
position
:表示一个 Vector3
对象,描述飞机的位置坐标。rotation
:表示一个 Euler
或 Quaternion
对象,描述飞机的旋转角度。该方法不返回任何值。
var plane = new Yuka.Plane();
var position = new Yuka.Vector3(10, 0, 5);
var rotation = new Yuka.Euler(0, Math.PI / 2, 0);
plane.set(position, rotation);
在上述示例中,将创建一个新的 Plane
对象,并通过 set()
方法将其位置设置为 (10, 0, 5)
,旋转角度为沿 Y 轴旋转 90 度。
如果 position
或 rotation
参数不是有效的 Vector3
或 Euler
/Quaternion
对象,则会抛出一个 TypeError
。