Methods
Model
transformModel
Applies a transformation to the specified model.
The transformation is always relative to the default model transform. This is an absolute position and zero rotation.
JS
1const modelId = "my-model-id";
2const transform = {
3 position: {
4 x: 1.0,
5 y: 1.0,
6 z: 0.0,
7 },
8 rotation: {
9 centerOfRotation: {
10 x: 1.0,
11 y: 0.0,
12 z: 0.0,
13 },
14 angle: 3.14,
15 },
16};
17
18viewer2d.transformModel(modelId, transform);
Id of the model to transform.
Type | Required |
---|---|
String | Yes |
Transformation to apply.
Type | Required |
---|---|
Object | Yes |
Properties
Name | Type | Required | Description |
---|---|---|---|
position | Vector3 | No | Position to move to |
rotation | Rotation | No | Rotation transform |
Rotation
Name | Type | Required | Description |
---|---|---|---|
angle | Number | Yes | Angle in radians |
centerOfRotation | Vector3 | Yes | Point to rotate over |