addShape
Adds a shape to the scene.
Example
Usage
Box Shape
const boxShape = {
extents: {
x: 0.5,
y: 0.5,
z: 0.5
},
position: {
x: 1.0,
y: 1.0,
z: 1.0
},
type: "box"
};
const shapeId = viewer3d.addShape(boxShape);Circle Shape
const circleShape = {
position: {
x: 1.0,
y: 1.0,
z: 1.0
},
radius: 1.0,
type: "circle"
};
const shapeId = viewer3d.addShape(circleShape);Sphere Shape
const sphereShape = {
position: {
x: 1.0,
y: 1.0,
z: 1.0
},
radius: 1.0,
type: "sphere"
};
const shapeId = viewer3d.addShape(sphereShape);Parameters
shape
Shape to add.
Type | Required |
|---|---|
Object | Yes |
Box Shape
onClick
Function called when user clicks the box.
Type |
|---|
() => Void |
Circle Shape
Name | Type | Required | Description |
|---|---|---|---|
color | String | No | Color of the circle |
id | String | No | Id of the circle |
onClick | Function | No | Function called when user clicks the circle |
position | Vector3 | Yes | Position of the circle |
radius | Number | Yes | Radius of the circle in meters |
type | String | Yes | Value must be circle |
onClick
Function called when user clicks the circle.
Type |
|---|
() => Void |
Sphere Shape
Name | Type | Required | Description |
|---|---|---|---|
color | String | No | Color of the sphere |
id | String | No | Id of the sphere |
onClick | Function | No | Function called when user clicks the sphere |
position | Vector3 | Yes | Position of the sphere |
radius | Number | Yes | Radius of the sphere in meters |
type | String | Yes | Value must be sphere |
onClick
Function called when user clicks the sphere.
Type |
|---|
() => Void |
Return Value
Id of the shape.
Type |
|---|
String |