Effect
Associated namespace: sm.effect
A userdata object representing an effect.
Values:
Functions:
- bindEventCallback
- clearEventCallbacks
- destroy
- getCameraFov
- getCameraPosition
- getCameraRotation
- getId
- hasActiveCamera
- isDone
- isPlaying
- setAutoPlay
- setOffsetPosition
- setOffsetRotation
- setParameter
- setPosition
- setRotation
- setScale
- setTimeOfDay
- setVelocity
- setWorld
- start
- stop
- stopBreakSustain
- stopImmediate
Operations:
Operation | Description |
---|---|
Effect == Effect | Checks if two instances of Effect refer to the same Effect. |
id integer
Get:
Returns the id of an effect.
bindEventCallback(effect, methodName, params=nil, reference=nil)
Client only
Bind an lua callback to be triggerd by the effect.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
string | methodName | The name of the callback method being bound. Example: MyClass.methodName( self, event, params ) |
any | params=nil | Parameter object passed to the callback. (Optional) |
table | reference=nil | Table to recieve the callback. (Optional) |
clearEventCallbacks(effect)
Client only
Clear all lua effect callbacks.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
destroy(effect)
Stops and destroys the effect.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
getCameraFov(effect)
Client only
Get the desired camera FOV.
Will return nil if the effect is not playing.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Returns:
Type | Description |
---|---|
number | The FOV. |
getCameraPosition(effect)
Client only
Get the desired camera position.
Will return nil if the effect is not playing.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Returns:
Type | Description |
---|---|
Vec3 | The position vector. |
getCameraRotation(effect)
Client only
Get the desired camera rotation.
Will return nil if the effect is not playing.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Returns:
Type | Description |
---|---|
Quat | The rotation. |
getId(effect)
Returns the id of an effect.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Returns:
Type | Description |
---|---|
integer | The effect's id. |
hasActiveCamera(effect)
Client only
Check if the effect has an active camera effect.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Returns:
Type | Description |
---|---|
boolean | Is active. |
isDone(effect)
Client only
Returns whether the effect is done, meaning that all effect instances have finished.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Returns:
Type | Description |
---|---|
boolean | Whether effect is done. |
isPlaying(effect)
Client only
Returns whether the effect is currently playing.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Returns:
Type | Description |
---|---|
boolean | Whether effect is playing. |
setAutoPlay(The, Autoplay)
Client only
Sets an effect to start playing and repeating automatically.
Parameters:
Type | Name | Description |
---|---|---|
Effect | The | effect. |
boolean | Autoplay | enabled. |
setOffsetPosition(effect, offsetPosition)
Client only
Offsets the position of the effect relatively to the host interactable.
Note:
Does not work if the effect was created without a host interactable.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Vec3 | offsetPosition | The relative offset position. |
setOffsetRotation(effect, offsetRotation)
Client only
Offsets the orientation of the effect relatively to the host interactable.
Note:
Does not work if the effect was created without a host interactable.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Quat | offsetRotation | The relative offset rotation. |
setParameter(effect, name, value)
Client only
Sets a named parameter value on the effect.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
string | name | The name. |
any | value | The effect parameter value. |
setPosition(effect, position)
Client only
Sets the position of an effect.
Note:
Does not work if the effect was created with a host interactable.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Vec3 | position | The position. |
setRotation(effect, rotation)
Client only
Sets the orientation of an effect using a quaternion.
Note:
Does not work if the effect was created with a host interactable.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Quat | rotation | The rotation. |
setScale(effect, scale)
Client only
Sets the scale of an effect.
Note:
Only applies to effect renderables.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Vec3 | scale | The scale. |
setTimeOfDay(effect, enabled, start, end, inversed)
Client only
Sets an effect to be active during specific period of the day / night cycle.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
boolean | enabled | Time of day enabled. |
number | start | Start normalized time of day. |
number | end | End normalized time of day. |
boolean | inversed | If true, period between start-end becomes inactive time. |
setVelocity(effect, velocity)
Client only
Sets the velocity of an effect. The effect will move along at the set velocity until it receives a new position.
Note:
Does not work if the effect was created with a host interactable.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
Vec3 | velocity | The velocity. |
setWorld(effect, world)
Client only
Sets the world for an effect.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
World | world | The world. Defaults to world from script constext. (optional) |
start(effect)
Client only
Starts playing an effect.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
stop(effect)
Client only
Stops playing an effect
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
stopBreakSustain(effect)
Client only
Stops playing an effect, letting sound finish before destroying the effect.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
stopImmediate(effect)
Client only
Immediately stop playing an effect, sound effects ended immediately.
Parameters:
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |