Skip to content

@fibbojs / 3d / FCollider

Class: FCollider

A 3d collider that can be attached to a component.

Accessors

component

get component(): undefined | FComponent

set component(component): void

Parameters

component: undefined | FComponent

Returns

undefined | FComponent

Defined in

3d/src/core/FCollider.ts:314

Constructors

new FCollider()

new FCollider(scene, options?): FCollider

Creates a collider for a given component.

Parameters

scene: FScene

The scene the collider belongs to.

options?: FColliderOptions

The options for the collider.

Returns

FCollider

Example

ts
const collider = new FCollider(scene, {
  position: { x: 0, y: 0, z: 0 },
  scale: { x: 1, y: 1, z: 1 },
  rotation: { x: 0, y: 0, z: 0 },
  shape: FShapes.CUBOID
})

Defined in

3d/src/core/FCollider.ts:76

Methods

__SET_POSITION__()

__SET_POSITION__(position): void

Set the position of the collider.

Parameters

position: FVector3

The new position of the collider.

Returns

void

Defined in

3d/src/core/FCollider.ts:267


__SET_ROTATION__()

__SET_ROTATION__(rotation): void

Set the rotation of the collider.

Parameters

rotation: FVector3

The new rotation of the collider.

Returns

void

Defined in

3d/src/core/FCollider.ts:276


__SET_SCALE__()

__SET_SCALE__(scale): void

Set the scale of the collider.

Parameters

scale: FVector3

The new scale of the collider.

Returns

void

Defined in

3d/src/core/FCollider.ts:285


__UPDATE_POSITION__()

__UPDATE_POSITION__(initiator): void

Update the position of the collider according to the transform. This method should be called after updating the transform properties.

Parameters

initiator: boolean = false

By default (false), the collider won't be considered as the initiator of the position update. This means the new position will be the position of the attached component, plus the offset. Setting this to true will propagate the event to other objects (component, sensor,...).

Returns

void

Defined in

3d/src/core/FCollider.ts:180


__UPDATE_ROTATION__()

__UPDATE_ROTATION__(initiator): void

Update the rotation of the collider according to the transform. This method should be called after updating the transform properties.

Parameters

initiator: boolean = false

By default (false), the collider won't be considered as the initiator of the rotation update. This means the new rotation will be the rotation of the attached component, plus the offset. Setting this to true will propagate the event to other objects (component, sensor,...).

Returns

void

Defined in

3d/src/core/FCollider.ts:210


__UPDATE_SCALE__()

__UPDATE_SCALE__(initiator): void

Update the scale of the collider according to the transform. This method should be called after updating the transform properties.

Parameters

initiator: boolean = false

By default (false), the collider won't be considered as the initiator of the scale update. This means the new scale will be the scale of the attached component, plus the offset. Setting this to true will propagate the event to other objects (component, sensor,...).

Returns

void

Defined in

3d/src/core/FCollider.ts:240


frame()

frame(_delta): void

Parameters

_delta: number

Returns

void

Defined in

3d/src/core/FCollider.ts:167

Properties

__COLLIDER__

__COLLIDER__: Collider

RAPIER Collider

Defined in

3d/src/core/FCollider.ts:33


__COMPONENT__?

optional __COMPONENT__: FComponent

The component the collider is attached to.

Defined in

3d/src/core/FCollider.ts:37


offset

offset: FTransform

The transform offset of the collider.

Defined in

3d/src/core/FCollider.ts:45


shape

shape: FShapes

The shape of the collider.

Defined in

3d/src/core/FCollider.ts:49


transform

transform: FTransform

The transform of the collider.

Defined in

3d/src/core/FCollider.ts:41