Skip to content

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

ts
new particles_object(name: string): particles_object;

Parameters

ParameterTypeDescription
namestringParticle resource name.

Returns

particles_object

Methods

last_position()

ts
last_position(): vector;

Returns

vector

Last particle position.


load_path()

ts
load_path(path: string): void;

Load an object animator path for the particle system.

Parameters

ParameterTypeDescription
pathstringPath name.

Returns

void

Remarks

Reuses the current animator when the same path is already loaded.


looped()

ts
looped(): boolean;

Returns

boolean

Whether the particle system is looped.


move_to()

ts
move_to(position: vector, velocity: vector): void;

Move particles and provide velocity for interpolation.

Parameters

ParameterTypeDescription
positionvectorNew world position.
velocityvectorCurrent movement velocity.

Returns

void

Remarks

Use this while an effect is already playing to keep its parent transform current.


pause_path()

ts
pause_path(is_paused: boolean): void;

Pause or resume the loaded particle path.

Parameters

ParameterTypeDescription
is_pausedbooleanWhether path playback is paused.

Returns

void

Remarks

Requires load_path() to have created the internal animator.


play()

ts
play(): void;

Start particle playback at the current transform.

Returns

void


play_at_pos()

ts
play_at_pos(position: vector): void;

Play particles at a world position.

Parameters

ParameterTypeDescription
positionvectorWorld position.

Returns

void

Remarks

Updates the particle transform and starts non-looped playback.


playing()

ts
playing(): boolean;

Returns

boolean

Whether particles are currently playing.


set_direction()

ts
set_direction(direction: vector): void;

Set particle forward direction.

Parameters

ParameterTypeDescription
directionvectorNew normalized direction.

Returns

void

Remarks

Pass a meaningful direction vector; the engine builds the remaining basis vectors from it.


set_orientation()

ts
set_orientation(
   yaw: number, 
   pitch: number, 
   roll: number): void;

Set particle orientation.

Parameters

ParameterTypeDescription
yawnumberYaw angle.
pitchnumberPitch angle.
rollnumberRoll angle.

Returns

void


start_path()

ts
start_path(is_looped: boolean): void;

Start moving along the loaded path.

Parameters

ParameterTypeDescription
is_loopedbooleanWhether path playback loops.

Returns

void

Remarks

Requires load_path() first.


stop()

ts
stop(): void;

Stop particles immediately.

Returns

void


stop_deferred()

ts
stop_deferred(): void;

Stop particles after existing particles finish.

Returns

void


stop_deffered()

ts
stop_deffered(): void;

Stop particles after existing particles finish.

Returns

void


stop_path()

ts
stop_path(): void;

Stop path playback.

Returns

void

Remarks

Requires load_path() first.