This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.BodyParticles Class

Inherits from: Body

BodyParticles is a base class for BodyCloth and BodyRope classes. It uses a mass-spring simulation model, i.e. particles that are connected by inner joints. The particles are of sphere shape and characterized by a position, mass and velocity. The total mass of the whole cloth is distributed among them. Particles can be acted upon by a force or an impulse. The inner joints can be stretched (linear and angular separately), or linear joints can also be scaled, which provides the same stretching effect. When stretched to the specified distance, joins are torn (the distance is set separately for linear and angular joints).

See Also#

BodyParticles Class

Enums

ITERATIONS_MODE#

Iterations mode. Determines the way the number of iterations for solving the constraints of the particles body is calculated.
NameDescription
OVERRIDE = 0In this mode the resulting number of iterations is equal to the Iterations value set for the body.
MULTIPLICATION = 1In this mode the resulting number of iterations is equal to the value set for the body multiplied by the global physics iterations number.

Properties

int NumParticles#

The total number of particles that constitute the body.

float Rigidity#

The current rigidity of the body's inner joints movement, i.e. how much interpolated linear and angular velocities of all joints affect velocities of each separate joint.

float Restitution#

The current restitution of the body by bouncing.

float Radius#

The current radius of the particles forming the body and represented as sphere shapes.

int NumIterations#

The current number of iterations used to solve inner joints between particles.

float Mass#

The current mass of the body.

float LinearThreshold#

The current linear stretching of the body's inner joints. when passing this threshold, the joints tear up.

float LinearStretch#

The current scale for the length of linear joints (relative the source mesh topology).

float LinearRestitution#

The current restitution of the body's inner joints by linear stretching.

float LinearDamping#

The A value indicating how much the linear velocity of the particles decreases over time.

float Friction#

The current friction of the body by its contact with other surfaces.

float Distance#

The current distance of body simulation.

int Collision#

The A value indicating if collision with a body is enabled or not.

int CollisionMask#

The A collision bit mask for the body. two objects collide, if they both have matching masks.

float AngularThreshold#

The current threshold for angular folding of particles triangles connected by inner joints. when passing this threshold, the joints tear up.

float AngularRestitution#

The current restitution of the body's inner joints, when triangles formed by particles are folded angularly relative to each other.

BodyParticles.ITERATIONS_MODE IterationsMode#

The Current iteration mode of the particles body:

Members


void SetParticleMass ( int num, float mass ) #

Sets the mass for the specified particle.

Arguments

  • int num - Particle number.
  • float mass - Particle mass.

float GetParticleMass ( int num ) #

Returns the current mass of the specified particle.

Arguments

  • int num - Particle number.

Return value

Particle mass.

void SetParticlePosition ( int num, vec3 position ) #

Sets the position of the specified body's particle.

Arguments

  • int num - Particle number.
  • vec3 position - Particle position in world coordinates.

vec3 GetParticlePosition ( int num ) #

Returns the current position of the specified particle.

Arguments

  • int num - Particle number.

Return value

Particle position in world coordinates.

void SetParticleVelocity ( int num, vec3 velocity ) #

Sets the velocity of the specified particle.

Arguments

  • int num - Particle number.
  • vec3 velocity - Particle velocity.

vec3 GetParticleVelocity ( int num ) #

Returns the current velocity of the specified particle.

Arguments

  • int num - Particle number.

Return value

Particle velocity.

void AddParticleForce ( int num, vec3 force ) #

Applies a force to the given particle. Integrated forces are applied after calling the update.

Arguments

  • int num - Particle number.
  • vec3 force - Amount of force to apply.

void AddParticleImpulse ( int num, vec3 impulse ) #

Applies an impulse to the given particle. Impulses immediately affect particles velocities.

Arguments

  • int num - Particle number.
  • vec3 impulse - Amount of impulse to apply.

void SetIterationsMode ( BodyParticles.ITERATIONS_MODE mode ) #

Sets iteration mode to be used for the particles body. The mode determines how the number of iterations for solving the constraints of the particles body is calculated. This method adds flexibility in fine-tuning of performance and simulation quality for each particles body.

Arguments

BodyParticles.ITERATIONS_MODE GetIterationsMode ( ) #

Returns the current iteration mode to be used for the particles body. The mode determines how the number of iterations for solving the constraints of the particles body is calculated. This method adds flexibility in fine-tuning of performance and simulation quality for each particles body.

Return value

Current iteration mode of the particles body:
Last update: 2022-12-14
Build: ()