Skip to content

@fibbojs / 3d / FCharacterControllerKV

Class: FCharacterControllerKV

A pre-defined character controller based on a Kinematic Velocity RigidBody.

Example

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

const scene = new FScene()

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

Extends

Constructors

new FCharacterControllerKV()

new FCharacterControllerKV(scene, options): FCharacterControllerKV

Parameters

scene: FScene

options: FCharacterControllerOptions

Returns

FCharacterControllerKV

Overrides

FCharacterControllerK.constructor

Defined in

3d/src/controllers/FCharacterControllerKV.ts:22

Methods

frame()

frame(delta): void

Update the controller. Should be called every frame. The purpose of this method is to update the component transform based on the controller logic.

Parameters

delta: number

The time since the last frame.

Returns

void

Overrides

FCharacterControllerK.frame

Defined in

3d/src/controllers/FCharacterControllerKV.ts:32


getCorrectedMovements()

getCorrectedMovements(): FVector3

Return the corrected movements for the current frame.

Returns

FVector3

Inherited from

FCharacterControllerK.getCorrectedMovements

Defined in

3d/src/controllers/FCharacterControllerK.ts:48


getCorrectedRotation()

getCorrectedRotation(): Quaternion

Return the corrected rotation for the current frame. Uses the camera so the character nevers faces the camera.

Returns

Quaternion

Inherited from

FCharacterControllerK.getCorrectedRotation

Defined in

3d/src/controllers/FCharacterController.ts:122

Properties

characterController

characterController: KinematicCharacterController

The character controller that will be used to move the character.

Inherited from

FCharacterControllerK.characterController

Defined in

3d/src/controllers/FCharacterControllerK.ts:22


component

component: FComponent

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

Inherited from

FCharacterControllerK.component

Defined in

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


inputs

inputs: object

The inputs that will be used to move the character.

backward

backward: boolean

forward

forward: boolean

left

left: boolean

right: boolean

Inherited from

FCharacterControllerK.inputs

Defined in

3d/src/controllers/FCharacterController.ts:25


scene

scene: FScene

The scene where the character is.

Inherited from

FCharacterControllerK.scene

Defined in

3d/src/controllers/FCharacterController.ts:40


speed

speed: number

The speed of the character.

Inherited from

FCharacterControllerK.speed

Defined in

3d/src/controllers/FCharacterController.ts:35


yVelocity

yVelocity: number

The y velocity of the character. Used to apply gravity.

Inherited from

FCharacterControllerK.yVelocity

Defined in

3d/src/controllers/FCharacterControllerK.ts:17