Skip to content

@fibbojs / 3d / FPointLight

Class: FPointLight

A point light in 3d space.

Extends

Accessors

color

get color(): Color

set color(color): void

Parameters

color: ColorRepresentation

Returns

Color

Inherited from

FLight.color

Defined in

3d/src/lights/FLight.ts:93


intensity

get intensity(): number

set intensity(intensity): void

Parameters

intensity: number

Returns

number

Inherited from

FLight.intensity

Defined in

3d/src/lights/FLight.ts:101


lookAt

get lookAt(): object

set lookAt(lookAt): void

Parameters

lookAt

lookAt.x: number

lookAt.y: number

lookAt.z: number

Returns

object

x

x: number

y

y: number

z

z: number

Inherited from

FLight.lookAt

Defined in

3d/src/lights/FLight.ts:105

Constructors

new FPointLight()

new FPointLight(scene, options?): FPointLight

Parameters

scene: FScene

options?: FLightOptions

Returns

FPointLight

Overrides

FLight.constructor

Defined in

3d/src/lights/FPointLight.ts:11

Methods

applyTransform()

applyTransform(): void

Returns

void

Inherited from

FLight.applyTransform

Defined in

3d/src/lights/FLight.ts:76


emitCollisionWith()

emitCollisionWith(options): void

Emit a collision event with a given class or object.

Parameters

options

The options for the collision event.

options.class?: any

The class to emit the collision event with.

options.component?: FComponent

The component to emit the collision event with.

Returns

void

Examples

typescript
const player = new Player()
const enemy = new Enemy()
player.emitCollisionWith({
  class: Enemy
})
typescript
const player = new Player()
const enemy = new Enemy()
player.emitCollisionWith({
  object: enemy
})

Inherited from

FLight.emitCollisionWith

Defined in

core/dist/index.d.ts:116


onCollisionWith()

onCollisionWith(classOrObject, callback): () => void

Add a callback to be called when a collision occurs.

Parameters

classOrObject: any

The class or object to add the callback to.

callback

The callback to add.

Returns

Function

A function to remove the callback.

Returns

void

Examples

typescript
const player = new Player()
const enemy = new Enemy()
player.onCollisionWith(Enemy, () => {
  console.log('Player collided with an Enemy!')
})
typescript
const player = new Player()
const enemy = new Enemy()
player.onCollisionWith(enemy, () => {
  console.log('Player collided with the enemy!')
})

Inherited from

FLight.onCollisionWith

Defined in

core/dist/index.d.ts:93


onFrame()

onFrame(_delta): void

Update the component. Should be called every frame. The purpose of onFrame on FComponent is really to render the component, its mesh/sprite and its properties. Any changes on its transform should be done on the controller, not here.

Parameters

_delta: number

Returns

void

Overrides

FLight.onFrame

Defined in

3d/src/lights/FPointLight.ts:40

Properties

__CALLBACKS_ON_COLLISION__

__CALLBACKS_ON_COLLISION__: object = {}

Callbacks for when a collision occurs with a given class or object. It is a dictionary where the key is the class name or object id and the value is an array of callbacks.

Index Signature

[key: string]: () => void[]

Inherited from

FLight.__CALLBACKS_ON_COLLISION__

Defined in

3d/src/lights/FLight.ts:24


__ID__

__ID__: number

Unique identifier for the component. It is generated automatically.

Inherited from

FLight.__ID__

Defined in

3d/src/lights/FLight.ts:23


__IS_2D__

__IS_2D__: boolean = false

Inherited from

FLight.__IS_2D__

Defined in

3d/src/lights/FLight.ts:22


__IS_3D__

__IS_3D__: boolean = true

Internal flags

Inherited from

FLight.__IS_3D__

Defined in

3d/src/lights/FLight.ts:21


__LOOK_AT__

__LOOK_AT__: object

Look at target of the light.

x

x: number

y

y: number

z

z: number

Inherited from

FLight.__LOOK_AT__

Defined in

3d/src/lights/FLight.ts:44


controller?

optional controller: FController

The controller attached to the component.

Inherited from

FLight.controller

Defined in

core/dist/index.d.ts:62


light

light: Light<undefined | LightShadow<Camera>>

The original light object from Three.js.

Inherited from

FLight.light

Defined in

3d/src/lights/FLight.ts:29


scene

scene: FScene

Scene the light is in.

Inherited from

FLight.scene

Defined in

3d/src/lights/FLight.ts:34


transform

transform: FTransform

Transform of the light.

Inherited from

FLight.transform

Defined in

3d/src/lights/FLight.ts:39