MeshShape
ClassAllows meshes to be used as collision shapes, for ColliderComponent and BodyComponent.
- Available on all platforms
Since Lens Scripting v181
Index
Properties
Methods
Extends
Properties
convex
convex:
boolean
Bake mesh as a convex hull, generated from mesh colliders. This allows for irregular shapes to be used as dynamic bodies.
Limitations:
They are non-deforming. A hull may be generated from a deforming render mesh, but it will not deform with it. Because of this, intrinsically deforming mesh types will not work as convex hulls. For instance world and face meshes. In these cases the convex hull will exist, but be empty and won’t simulate.
It produces an approximation of the source mesh, reducing triangle count and eliminating concave areas. Concave shapes may be composed of convex hulls in the scene graph. Splitting a concave mesh into convex hulls is known as "convex decomposition". It is an expensive process not supported by Studio, but there are many standalone tools available for this purpose (including plugins for 3D modeling apps). The resulting split mesh can be imported into Studio as a prefab.
Original triangle data is lost, so it is not available to script in ray casts.
Since
Lens Scripting Version 181
Default Value
false
mesh
mesh:
RenderMesh
Sets geometry from a render mesh. The render mesh is automatically converted to a collision mesh.
Since
Lens Scripting Version 181
Default Value
null
skin
skin:
Skin
Specifies skinning component used to animate skinned meshes.
Since
Lens Scripting Version 181
Default Value
null
Methods
createBoxShape()
staticcreateBoxShape():BoxShape
Create a BoxShape with default settings.
Returns
Since
Lens Scripting Version 157
Inherited from
createCapsuleShape()
staticcreateCapsuleShape():CapsuleShape
Create a CapsuleShape with default settings.
Returns
Since
Lens Scripting Version 157
Inherited from
createConeShape()
staticcreateConeShape():ConeShape
Create a ConeShape with default settings.
Returns
Since
Lens Scripting Version 169
Inherited from
createCylinderShape()
staticcreateCylinderShape():CylinderShape
Create a CylinderShape with default settings.
Returns
Since
Lens Scripting Version 169
Inherited from
createLevelsetShape()
staticcreateLevelsetShape():LevelsetShape
Create a LevelsetShape with default settings.
Returns
Since
Lens Scripting Version 157
Inherited from
createMeshShape()
staticcreateMeshShape():MeshShape
Creates a new MeshShape.
Returns
MeshShape
Since
Lens Scripting Version 181
Example
// Change gravity in the root world.
Physics.getRootWorldSettings().gravity = new vec3(0.0, -100.0, 0.0);
Inherited from
createSphereShape()
staticcreateSphereShape():SphereShape
Create a SphereShape with default settings.
Returns
Since
Lens Scripting Version 157
Inherited from
getTypeName()
staticgetTypeName():TypeName<MeshShape>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<MeshShape>
Since
Lens Scripting Version 181
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean