Classes
Members
getMaterial
Get this object material.
setMaterial
Change the material of this object to a copy of the provided one.
setOpacity
Set opacity for this object. Default is 1.
subdivide
Subdivides the geometry of the Mesh3D object using Loop subdivision.
🧪 This is an experimental feature: ⚠️ use with caution.
Methods
getColor() → {Number}
Get this object diffuse color.
Returns:
current diffuse color
- Type
- Number
getMetalness() → {Number}
Get this object metalness.
Returns:
current metalness
- Type
- Number
getOpacity() → {Number}
Get this object opacity.
Returns:
current opacity
- Type
- Number
getPosition() → {Vector}
Get current position
Returns:
position vector
- Type
- Vector
getPositionX() → {Number}
Get this object X position
Returns:
position X coordinate
- Type
- Number
getPositionY() → {Number}
Get this object Y position
Returns:
position Y coordinate
- Type
- Number
getPositionZ() → {Number}
Get this object Z position
Returns:
position Z coordinate
- Type
- Number
getRotation() → {Vector}
Get current rotation
Returns:
rotation vector
- Type
- Vector
getRoughness() → {Number}
Get this object roughness.
Returns:
current roughness
- Type
- Number
getScale() → {Vector}
Get current scale
Returns:
scale vector
- Type
- Vector
getScaleX() → {Number}
Get this object X scale
Returns:
scale X coordinate
- Type
- Number
getScaleY() → {Number}
Get this object Y scale
Returns:
scale Y coordinate
- Type
- Number
getScaleZ() → {Number}
Get this object Z scale
Returns:
scale Z coordinate
- Type
- Number
setColor(color) → {Mesh3D}
Change object color. You can use string, another Color or r,g,b parameters.
mesh.setColor("red"); mesh.setColor("#ff0000"); mesh.setColor(255, 0, 1);
Parameters:
Name | Type | Description |
---|---|---|
color |
Color | new color. |
Returns:
modified object
- Type
- Mesh3D
setMetalness(value) → {Mesh3D}
Set metalness for this object. Default is 0
Parameters:
Name | Type | Description |
---|---|---|
value |
Number | new metalness |
Returns:
modified object
- Type
- Mesh3D
setPosition(x, y, z) → {Mesh3D}
Set position of a Mesh3D.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
x |
Number | Vector | 0 | X coordinate or a p5.Vector with x,y,z (in this case ony one parameter is needed) |
y |
Number | 0 | Y coordinate |
z |
Number | 0 | Z coordinate |
Returns:
modified object
- Type
- Mesh3D
setPositionX(X) → {Mesh3D}
Set X position
Parameters:
Name | Type | Description |
---|---|---|
X |
Number | position |
Returns:
modified object
- Type
- Mesh3D
setPositionY(Y) → {Mesh3D}
Set Y position
Parameters:
Name | Type | Description |
---|---|---|
Y |
Number | position |
Returns:
modified object
- Type
- Mesh3D
setPositionZ(Z) → {Mesh3D}
Set Z position
Parameters:
Name | Type | Description |
---|---|---|
Z |
Number | position |
Returns:
modified object
- Type
- Mesh3D
setRotation(x, y, z) → {Mesh3D}
Set rotation of a Mesh3D.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
x |
Number | Vector | 0 | rotation along X in degrees or radians or a p5.Vector object (in this case ony one parameter is needed) |
y |
Number | 0 | rotation along Y in degrees or radians |
z |
Number | 0 | rotation along Z in degrees or radians |
Returns:
modified object
- Type
- Mesh3D
setRotationX(angle) → {Mesh3D}
Set the rotation along X axis
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | rotation along X in degrees or radians |
Returns:
modified object
- Type
- Mesh3D
setRotationY(angle) → {Mesh3D}
Set the rotation along Y axis
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | rotation along Y in degrees or radians |
Returns:
modified object
- Type
- Mesh3D
setRotationZ(angle) → {Mesh3D}
Set the rotation along Z axis
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | rotation along Z in degrees or radians |
Returns:
modified object
- Type
- Mesh3D
setRoughness(value) → {Mesh3D}
Set roughness for this object. Default is 1
Parameters:
Name | Type | Description |
---|---|---|
value |
Number | new roughness |
Returns:
modified object
- Type
- Mesh3D
setScale(…values)
If 1 parameter is used it can be a Number (in this case x,y,z are equals) or a Vector.
If 3 parameters are used they will be X,Y and Z scale.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
values |
any |
<repeatable> |
1 or 3 Numbers or 1 Vector to define new scale. |
Returns:
modified object
setScaleX(x) → {Mesh3D}
Set X scale.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | X coordinate |
Returns:
modified object
- Type
- Mesh3D
setScaleY(y) → {Mesh3D}
Set Y scale.
Parameters:
Name | Type | Description |
---|---|---|
y |
Number | Y coordinate |
Returns:
modified object
- Type
- Mesh3D
setScaleZ(z) → {Mesh3D}
Set Z scale.
Parameters:
Name | Type | Description |
---|---|---|
z |
Number | Z coordinate |
Returns:
modified object
- Type
- Mesh3D