This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
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
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: 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

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.
set
Sets 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.
set value - Rigidity of joints interaction. Provided value is saturated in range [0;1.0]:
  • By the value of 0, joints move independently.
  • By the value of 1, joints move uniformly, as interpolated velocity greatly changes velocities of each joint.

float Restitution#

The current restitution of the body by bouncing.
set
Sets the restitution of the body by bouncing.
set value - Body restitution. Provided value is saturated in range [0;1.0].

float Radius#

The current radius of the particles forming the body and represented as sphere shapes.
set
Sets the radius of the particles forming the body and represented as sphere shapes.
set value - Radius of the sphere-shaped particles.

int NumIterations#

The current number of iterations used to solve inner joints between particles.
set
Sets the number of iterations used to solve inner joints between the particles. Note that if this value is too low, the precision of calculations will suffer.
set value - Number of iterations. If a non-positive value is provided, 1 will be used instead.

float Mass#

The current mass of the body.
set
Sets a mass of the body.
set value - Mass of the body. If a negative value is provided, 0 will be used instead.

float LinearThreshold#

The current linear stretching of the body's inner joints. when passing this threshold, the joints tear up.
set
Sets the threshold for linear stretching of the body's inner joints. When passing this threshold, the joints tear up.
set value - Linear stretching threshold. If a negative value is provided, 0 will be used instead.

float LinearStretch#

The current scale for the length of linear joints (relative the source mesh topology).
set
Sets the scale for the length of linear joints (relative the source mesh topology).
set value - Stretch scale for linear joints. If a negative value is provided, 0 will be used instead.

float LinearRestitution#

The current restitution of the body's inner joints by linear stretching.
set
Sets the restitution of the body's inner joints by linear stretching.
set value - Joints linear restitution. Provided value is saturated in range [0;1.0].

float LinearDamping#

A value indicating how much the linear velocity of the particles decreases over time.
set
Sets a value indicating how much the linear velocity of the particles decreases over time.
set value - Linear damping value. If a negative value is provided, 0 will be used instead.

float Friction#

The current friction of the body by its contact with other surfaces.
set
Sets the friction of the body by its contact with other surfaces.
set value - Body friction. If a negative value is provided, 0 will be used instead.

float Distance#

The current distance of body simulation.
set
Sets the distance of body simulation.
set value - Distance of simulation. If a negative value is provided, 0 will be used instead.

int Collision#

A value indicating if collision with a body is enabled or not.
set
Sets a value indicating if collision with a body is enabled or not.
set value - Positive value to enable collision, 0 to disable it.

int CollisionMask#

A collision bit mask for the body. two objects collide, if they both have matching masks.
set
Sets a collision bit mask for the body. Two objects collide, if they both have matching masks.
set value - Integer, each bit of which is a mask.

float AngularThreshold#

The current threshold for angular folding of particles triangles connected by inner joints. when passing this threshold, the joints tear up.
set
Sets the threshold for angular folding of particles triangles connected by inner joints. When passing this threshold, the joints tear up.
set value - Joints angular folding threshold. If a negative value is provided, 0 will be used instead.

float AngularRestitution#

The current restitution of the body's inner joints, when triangles formed by particles are folded angularly relative to each other.
set
Sets the restitution of the body's inner joints, when triangles formed by particles are folded angularly relative to each other.
set value - Joints angular restitution. Provided value is saturated in range [0;1.0].

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.
Last update: 2020-04-10
Build: ()