位置，旋转和缩放

101课程仅考虑网格的位置，旋转和缩放的设置进一步阅读 将向您展示一系列方法，用于将网格平移和旋转给定量。

参考框架

Babylon.js使用两个参考框架，世界轴和局部轴。世界轴的起源永远不会改变。

位置

``````pilot.position = new BABYLON.Vector3(2, 3, 4);
``````

``````pilot.position.x  =  2;
pilot.position.y  =  3;
pilot.position.z  =  4;
```
```

回转

`````` pilot.rotation = new BABYLON.Vector3(alpha, beta, gamma);
``````

``````pilot.rotation.x  =  alpha; //rotation around x axis
pilot.rotation.y  =  beta;  //rotation around y axis
pilot.rotation.z  =  gamma; //rotation around z axis
``````

T较小的轴代表世界轴的方向。

摘要

``````pilot.rotation = new BABYLON.Vector3(alpha, beta, gamma);

pilot.rotation.x  =  alpha;
pilot.rotation.y  =  beta;
pilot.rotation.z  =  gamma;

pilot.rotation.z  =  gamma;
pilot.rotation.x  =  alpha;
pilot.rotation.y  =  beta;

pilot.rotation.y  =  beta;
pilot.rotation.z  =  gamma;
pilot.rotation.x  =  alpha;
``````

顺序旋转

``````mesh.addRotation(Math.PI/2, 0, 0).addRotation(0, Math.PI/2, 0).addRotation(0, 0, Math.PI/2);
```
```

RotationQuaternions

_rotations的另一种选择是 rotationQuaternions 虽然它们使用起来很棘手但可以克服一些万向节锁定问题。在网格上使用两者都不可能看到警告

缩放

``````mesh.scaling = new BABYLON.Vector3(scale_x, scale_y, scale_z);
```
```

`````` mesh.scaling.y = 5;
```
```