Skip to content

@fibbojs / 2d / FCharacterControllerD

Class: FCharacterControllerD

A pre-defined character controller based on a Dynamic RigidBody.

Example

ts
import { FCapsule, FCharacterControllerD, FScene } from '@fibbojs/3d'

const scene = new FScene()

const capsule = new FCapsule(scene)
capsule.controller = new FCharacterControllerD(scene)
scene.addComponent(capsule)

Extends

Constructors

new FCharacterControllerD()

new FCharacterControllerD(scene, options): FCharacterControllerD

Parameters

scene: FScene

options: FCharacterControllerOptions

Returns

FCharacterControllerD

Overrides

FCharacterController.constructor

Defined in

2d/src/controllers/FCharacterControllerD.ts:22

Methods

onFrame()

onFrame(_delta): void

Update the controller. Should be called every frame. The purpose of onFrame on FController is to update the component's transform in the desired way. Any rendering process should be done on the component, not here.

Parameters

_delta: number

Returns

void

Overrides

FCharacterController.onFrame

Defined in

2d/src/controllers/FCharacterControllerD.ts:38

Properties

component

component: FComponent

The component attached to the controller. It is redefined here to get the correct type (with 2D properties).

Inherited from

FCharacterController.component

Defined in

2d/src/controllers/FController.ts:17


inputs

inputs: object

The inputs that will be used to move the character.

down

down: boolean

left

left: boolean

right: boolean

up

up: boolean

Inherited from

FCharacterController.inputs

Defined in

2d/src/controllers/FCharacterController.ts:21


scene

scene: FScene

The scene where the character is.

Inherited from

FCharacterController.scene

Defined in

2d/src/controllers/FCharacterController.ts:36


speed

speed: number

The speed of the character.

Inherited from

FCharacterController.speed

Defined in

2d/src/controllers/FCharacterController.ts:31