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#
- The Creating and Attaching a Cloth usage example demonstrating how to set rope parameters
BodyParticles Class
Enums
ITERATIONS_MODE#
Iterations mode. Determines the way the number of iterations for solving the constraints of the particles body is calculated.Name | Description |
---|---|
OVERRIDE = 0 | In this mode the resulting number of iterations is equal to the Iterations value set for the body. |
MULTIPLICATION = 1 | In 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:
- OVERRIDE - the resulting number of iterations is equal to the value set for the body.
- MULTIPLICATION - the resulting number of iterations is equal to the value set for the body multiplied by the global physics iterations number.
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 mode - Iteration mode to be used for the particles body:
- OVERRIDE - the resulting number of iterations is equal to the value set for the body.
- MULTIPLICATION - the resulting number of iterations is equal to the value set for the body multiplied by the global physics iterations number.
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:- OVERRIDE - the resulting number of iterations is equal to the value set for the body.
- MULTIPLICATION - the resulting number of iterations is equal to the value set for the body multiplied by the global physics iterations number.
Last update:
2021-02-05
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)