CLASSES
TagsA - Z

SpotLight

NodeLight

Description

class SpotLight extends ShadowLight

A spot light is defined by a position, a direction, an angle and an exponent.

These values define a cone of light starting from the position toward the direction.

A tutorial about lights can be found here : https://doc.babylonjs.com/tutorials/lights

Constructor

new SpotLight(name, position, direction, angle, exponent, scene)

Creates a SpotLight object in the scene with the passed parameters :

A spot light is a simply light oriented cone.

It can cast shadows.

Documentation : http://doc.babylonjs.com/tutorials/lights

Parameters

Name Type Description
name string The name of the object
position Vector3 The position of the light in the scene
direction Vector3 The initial direction of the light
angle number The initial angle of the light
exponent number The initial exponent of the light

Members

angle : number

The size of the spotlight beam

shadowAngleScale : number

Allows scaling the angle of the light for shadow generation only.

exponent : number

The speed of the decay of the light with distance

Methods

getClassName() string

Returns the string "SpotLight".

getTypeID() number

Returns the integer 2.

transferToEffect(effect, lightIndex) SpotLight

Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.

Return the SpotLight.

Parameters

Name Type Description
effect Effect The given effect
lightIndex string