Skip to content

@fibbojs / 3d / FSensor

Class: FSensor ​

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

Example ​

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

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

Extends ​

Accessors ​

component ​

get component(): FComponent

set component(component): void

Parameters ​

• component: FComponent

Returns ​

FComponent

Inherited from ​

FRigidBody.component

Defined in ​

3d/src/core/FRigidBody.ts:372

Constructors ​

new FSensor() ​

new FSensor(options?): FSensor

Creates a rigidBody for the given component.

Parameters ​

• options?: FRigidBodyOptions

The options for the rigidBody.

Returns ​

FSensor

Overrides ​

FRigidBody.constructor

Defined in ​

3d/src/core/FSensor.ts:42

Methods ​

__SET_POSITION__() ​

__SET_POSITION__(position): void

Set the position of the rigidBody.

Parameters ​

• position: FVector3

The new position of the rigidBody.

Returns ​

void

Inherited from ​

FRigidBody.__SET_POSITION__

Defined in ​

3d/src/core/FRigidBody.ts:334


__SET_ROTATION__() ​

__SET_ROTATION__(rotation): void

Set the rotation of the rigidBody.

Parameters ​

• rotation: FVector3

The new rotation of the rigidBody.

Returns ​

void

Inherited from ​

FRigidBody.__SET_ROTATION__

Defined in ​

3d/src/core/FRigidBody.ts:344


__SET_SCALE__() ​

__SET_SCALE__(scale): void

Set the scale of the rigidBody.

Parameters ​

• scale: FVector3

The new scale of the rigidBody.

Returns ​

void

Inherited from ​

FRigidBody.__SET_SCALE__

Defined in ​

3d/src/core/FRigidBody.ts:354


__UPDATE_POSITION__() ​

__UPDATE_POSITION__(initiator): void

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

Parameters ​

• initiator: boolean = false

By default (false), the rigidBody 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

Inherited from ​

FRigidBody.__UPDATE_POSITION__

Defined in ​

3d/src/core/FRigidBody.ts:247


__UPDATE_ROTATION__() ​

__UPDATE_ROTATION__(initiator): void

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

Parameters ​

• initiator: boolean = false

By default (false), the rigidBody 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

Inherited from ​

FRigidBody.__UPDATE_ROTATION__

Defined in ​

3d/src/core/FRigidBody.ts:277


__UPDATE_SCALE__() ​

__UPDATE_SCALE__(initiator): void

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

Parameters ​

• initiator: boolean = false

By default (false), the rigidBody 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

Inherited from ​

FRigidBody.__UPDATE_SCALE__

Defined in ​

3d/src/core/FRigidBody.ts:307


frame() ​

frame(_delta): void

Parameters ​

• _delta: number

Returns ​

void

Inherited from ​

FRigidBody.frame

Defined in ​

3d/src/core/FRigidBody.ts:209


setAngvel() ​

setAngvel(velocity): void

Set the angular velocity of the rigidBody.

Parameters ​

• velocity: FVector3

The new angular velocity of the rigidBody.

Returns ​

void

Inherited from ​

FRigidBody.setAngvel

Defined in ​

3d/src/core/FRigidBody.ts:236


setLinvel() ​

setLinvel(velocity): void

Set the linear velocity of the rigidBody.

Parameters ​

• velocity: FVector3

The new linear velocity of the rigidBody.

Returns ​

void

Inherited from ​

FRigidBody.setLinvel

Defined in ​

3d/src/core/FRigidBody.ts:228

Properties ​

__COMPONENT__? ​

optional __COMPONENT__: FComponent

The component the rigidBody is attached to.

Inherited from ​

FRigidBody.__COMPONENT__

Defined in ​

3d/src/core/FRigidBody.ts:67


__RIGIDBODY__ ​

__RIGIDBODY__: RigidBody

RAPIER RigidBody

Inherited from ​

FRigidBody.__RIGIDBODY__

Defined in ​

3d/src/core/FRigidBody.ts:59


collider ​

collider: FCollider

Fibbo Collider

Inherited from ​

FRigidBody.collider

Defined in ​

3d/src/core/FRigidBody.ts:63


offset ​

offset: FTransform

The transform offset of the rigidBody.

Inherited from ​

FRigidBody.offset

Defined in ​

3d/src/core/FRigidBody.ts:75


transform ​

transform: FTransform

The transform of the rigidBody.

Inherited from ​

FRigidBody.transform

Defined in ​

3d/src/core/FRigidBody.ts:71