Class: particles_object
Script-controlled particle system.
Source
src/xrGame/script_particles_script.cpp, particles_object binding.
Custom Constructor
particles_object
Remarks
Path playback methods require a path loaded with load_path() first.
Constructors
Constructor
new particles_object(name: string): particles_object;Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Particle resource name. |
Returns
particles_object
Methods
last_position()
last_position(): vector;Returns
Last particle position.
load_path()
load_path(path: string): void;Load an object animator path for the particle system.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Path name. |
Returns
void
Remarks
Reuses the current animator when the same path is already loaded.
looped()
looped(): boolean;Returns
boolean
Whether the particle system is looped.
move_to()
move_to(position: vector, velocity: vector): void;Move particles and provide velocity for interpolation.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | vector | New world position. |
velocity | vector | Current movement velocity. |
Returns
void
Remarks
Use this while an effect is already playing to keep its parent transform current.
pause_path()
pause_path(is_paused: boolean): void;Pause or resume the loaded particle path.
Parameters
| Parameter | Type | Description |
|---|---|---|
is_paused | boolean | Whether path playback is paused. |
Returns
void
Remarks
Requires load_path() to have created the internal animator.
play()
play(): void;Start particle playback at the current transform.
Returns
void
play_at_pos()
play_at_pos(position: vector): void;Play particles at a world position.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | vector | World position. |
Returns
void
Remarks
Updates the particle transform and starts non-looped playback.
playing()
playing(): boolean;Returns
boolean
Whether particles are currently playing.
set_direction()
set_direction(direction: vector): void;Set particle forward direction.
Parameters
| Parameter | Type | Description |
|---|---|---|
direction | vector | New normalized direction. |
Returns
void
Remarks
Pass a meaningful direction vector; the engine builds the remaining basis vectors from it.
set_orientation()
set_orientation(
yaw: number,
pitch: number,
roll: number): void;Set particle orientation.
Parameters
| Parameter | Type | Description |
|---|---|---|
yaw | number | Yaw angle. |
pitch | number | Pitch angle. |
roll | number | Roll angle. |
Returns
void
start_path()
start_path(is_looped: boolean): void;Start moving along the loaded path.
Parameters
| Parameter | Type | Description |
|---|---|---|
is_looped | boolean | Whether path playback loops. |
Returns
void
Remarks
Requires load_path() first.
stop()
stop(): void;Stop particles immediately.
Returns
void
stop_deferred()
stop_deferred(): void;Stop particles after existing particles finish.
Returns
void
stop_deffered()
stop_deffered(): void;Stop particles after existing particles finish.
Returns
void
stop_path()
stop_path(): void;Stop path playback.
Returns
void
Remarks
Requires load_path() first.