Skip to content

@fibbojs / 3d / FCollider

Class: FCollider ​

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

Example ​

ts
import { FCollider } from '@fibbojs/3d'

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

Accessors ​

component ​

get component(): FComponent

set component(component): void

Parameters ​

• component: FComponent

Returns ​

FComponent

Defined in ​

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

Constructors ​

new FCollider() ​

new FCollider(options?): FCollider

Creates a collider for a given component.

Parameters ​

• options?: FColliderOptions

The options for the collider.

Returns ​

FCollider

Defined in ​

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

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:284


__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:293


__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:302


__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:197


__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:227


__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:257


frame() ​

frame(_delta): void

Parameters ​

• _delta: number

Returns ​

void

Defined in ​

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

Properties ​

__COLLIDER__ ​

__COLLIDER__: Collider

RAPIER Collider

Defined in ​

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


__COMPONENT__? ​

optional __COMPONENT__: FComponent

The component the collider is attached to.

Defined in ​

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


offset ​

offset: FTransform

The transform offset of the collider.

Defined in ​

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


shape ​

shape: FShapes

The shape of the collider.

Defined in ​

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


transform ​

transform: FTransform

The transform of the collider.

Defined in ​

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