Skip to content

Class: SphereColliderShape

Spherical collision body

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

constructor

new SphereColliderShape(radius): SphereColliderShape

Parameters

NameTypeDescription
radiusnumberradius of this collider

Returns

SphereColliderShape

Overrides

ColliderShape.constructor

Defined in

src/components/shape/SphereColliderShape.ts:26

Properties

radius

radius: number = 0.5

radius of this collider

Defined in

src/components/shape/SphereColliderShape.ts:20

Accessors

shapeType

get shapeType(): ColliderShapeType

Returns

ColliderShapeType

Inherited from

ColliderShape.shapeType

Defined in

src/components/shape/ColliderShape.ts:40


center

get center(): Vector3

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

Returns

Vector3

Inherited from

ColliderShape.center

Defined in

src/components/shape/ColliderShape.ts:59

set center(value): void

Parameters

NameType
valueVector3

Returns

void

Inherited from

ColliderShape.center

Defined in

src/components/shape/ColliderShape.ts:63


size

get size(): Vector3

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

Returns

Vector3

Vector3

Inherited from

ColliderShape.size

Defined in

src/components/shape/ColliderShape.ts:72

set size(value): void

Parameters

NameType
valueVector3

Returns

void

Inherited from

ColliderShape.size

Defined in

src/components/shape/ColliderShape.ts:76


halfSize

get halfSize(): Vector3

Half the size of the collision body.

Returns

Vector3

Inherited from

ColliderShape.halfSize

Defined in

src/components/shape/ColliderShape.ts:84

Methods

setFromCenterAndSize

setFromCenterAndSize(ct?, sz?): this

Set the position and size of collision objects

Parameters

NameTypeDescription
ct?Vector3The position of the collision object in the local space of the object.
sz?Vector3The size of the collision body in the X, Y, and Z directions.

Returns

this

Inherited from

ColliderShape.setFromCenterAndSize

Defined in

src/components/shape/ColliderShape.ts:50


rayPick

rayPick(ray, fromMatrix): Object

Ray pickup.Emit a ray from a designated location to detect objects colliding with the ray.

Parameters

NameTypeDescription
rayRayemit ray
fromMatrixMatrix4matrix

Returns

Object

Pick result intersect: whether to collide; IntersectPoint: collision point; Distance: The distance from the origin of the ray to the collision point.

NameType
intersectboolean
intersectPoint?Vector3
distancenumber

Overrides

ColliderShape.rayPick

Defined in

src/components/shape/SphereColliderShape.ts:33