Skip to content

@orillusion/core


Class: MeshColliderShape ​

Defined in: src/components/shape/MeshColliderShape.ts:15

Mesh collision body

Extends ​

Constructors ​

Constructor ​

new MeshColliderShape(): MeshColliderShape

Defined in: src/components/shape/MeshColliderShape.ts:49

Returns ​

MeshColliderShape

Overrides ​

ColliderShape.constructor

Properties ​

mesh ​

mesh: GeometryBase

Defined in: src/components/shape/MeshColliderShape.ts:20

Geometry to pick against. When left unset, ColliderComponent uses the geometry of the MeshRenderer on the same object.


backfaceCulling ​

backfaceCulling: boolean = false

Defined in: src/components/shape/MeshColliderShape.ts:23

Skip triangles whose front face points away from the ray.


useBVH ​

useBVH: RaycastBVHMode = 'always'

Defined in: src/components/shape/MeshColliderShape.ts:31

When to use the geometry's MeshBVH. Default 'always': the tree is built on the first pick and cached per geometry. Use 'auto' to only use a tree built elsewhere (MeshBVH.build), 'never' to always test every triangle.


maxDistance ​

maxDistance: number = Infinity

Defined in: src/components/shape/MeshColliderShape.ts:34

Ignore hits farther than this (world units).


renderer ​

renderer: MeshRenderer = null

Defined in: src/components/shape/MeshColliderShape.ts:41

Renderer drawing mesh, set automatically by ColliderComponent from the same object. When it skins or morphs the mesh, picks follow the deformed surface (see deformation).


deformation ​

deformation: RaycastDeformation = 'cpu'

Defined in: src/components/shape/MeshColliderShape.ts:44

How a skinned / morphed renderer is picked. Default 'cpu': as drawn.

Accessors ​

shapeType ​

Get Signature ​

get shapeType(): ColliderShapeType

Defined in: src/components/shape/ColliderShape.ts:73

Returns ​

ColliderShapeType

Inherited from ​

ColliderShape.shapeType


center ​

Get Signature ​

get center(): Vector3

Defined in: src/components/shape/ColliderShape.ts:92

The position of the collision object in the local space of the object.

Returns ​

Vector3

Set Signature ​

set center(value): void

Defined in: src/components/shape/ColliderShape.ts:96

Parameters ​
value ​

Vector3

Returns ​

void

Inherited from ​

ColliderShape.center


size ​

Get Signature ​

get size(): Vector3

Defined in: src/components/shape/ColliderShape.ts:105

The size of the collision body in the X, Y, and Z directions.

Returns ​

Vector3

Vector3

Set Signature ​

set size(value): void

Defined in: src/components/shape/ColliderShape.ts:109

Parameters ​
value ​

Vector3

Returns ​

void

Inherited from ​

ColliderShape.size


halfSize ​

Get Signature ​

get halfSize(): Vector3

Defined in: src/components/shape/ColliderShape.ts:117

Half the size of the collision body.

Returns ​

Vector3

Inherited from ​

ColliderShape.halfSize

Methods ​

setFromCenterAndSize() ​

setFromCenterAndSize(ct?, sz?): this

Defined in: src/components/shape/ColliderShape.ts:83

Set the position and size of collision objects

Parameters ​

ct? ​

Vector3

The position of the collision object in the local space of the object.

sz? ​

Vector3

The size of the collision body in the X, Y, and Z directions.

Returns ​

this

Inherited from ​

ColliderShape.setFromCenterAndSize


transformNormal() ​

static transformNormal(invMatrix, n, out): Vector3

Defined in: src/components/shape/ColliderShape.ts:158

Transform a local-space normal to world space with the inverse transpose of the local → world matrix. See MeshRaycast.transformNormal.

Parameters ​

invMatrix ​

Matrix4

n ​

Vector3

out ​

Vector3

Returns ​

Vector3

Inherited from ​

ColliderShape.transformNormal


rayPick() ​

rayPick(ray, fromMatrix): HitInfo

Defined in: src/components/shape/MeshColliderShape.ts:62

Closest triangle hit along ray (world space), or null. With the default useBVH the cost is O(log n) triangles. distance, intersectPoint, normal (interpolated vertex normal, face normal when the geometry has none) and faceNormal are world space; the result also carries localPoint, faceIndex, barycentric, uv, uv1, subGeometryIndex and frontFace.

Parameters ​

ray ​

Ray

fromMatrix ​

Matrix4

Returns ​

HitInfo

Overrides ​

ColliderShape.rayPick

Released under the MIT License