TagsA - Z




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 :


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 :


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


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


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.


Name Type Description
effect Effect The given effect
lightIndex string