struct MAGES::MeshDeformations::RuntimeParticleData¶
Overview¶
Represents the runtime data for particles in the XPBD solver. More…
struct RuntimeParticleData
{
// fields
bool IsCreated;
int Count;
NativeArray Enabled;
NativeArray Breakable;
NativeArray PhysicsMaterialIndex;
NativeArray InitialPosition;
NativeArray Position;
NativeArray PredictedPosition;
NativeArray TemporaryPositionBuffer;
NativeArray LocalRestPosition;
NativeArray Velocity;
NativeArray InverseMass;
NativeArray AdjustedInverseMass;
NativeArray Phase;
NativeArray SimulationMeshDescriptorIndex;
NativeArray PositionCorrections;
NativeArray PositionCorrectionsCount;
NativeArray ParticleLocks;
// methods
void Create(
in int size,
NativeArrayOptions nativeArrayOptions = NativeArrayOptions.ClearMemory
);
int Resize(in int newSize);
int InsertAdditionalEmptySpace(in int additionalSize, in int emptySpacePosition);
void RemoveRange(in int index, in int length);
void Dispose();
};
Detailed Documentation¶
Represents the runtime data for particles in the XPBD solver.
Fields¶
bool IsCreated
Indicates whether the particle data has been initialized.
int Count
The number of particles.
NativeArrayEnabled
Indicates whether each particle is enabled.
NativeArrayBreakable
Indicates whether each particle is breakable.
NativeArrayPhysicsMaterialIndex
The index of the physics material for each particle.
NativeArrayInitialPosition
The initial position of each particle.
NativeArrayPosition
The current position of each particle.
NativeArrayPredictedPosition
The predicted position of each particle for the next simulation step.
NativeArrayTemporaryPositionBuffer
The temporary position buffer used for friction solving.
NativeArrayLocalRestPosition
The local rest position of each particle relative to the simulation mesh’s center of mass.
NativeArrayVelocity
The velocity of each particle.
NativeArrayInverseMass
The inverse mass of each particle.
NativeArrayAdjustedInverseMass
The adjusted inverse mass of each particle for faster convergence.
NativeArrayPhase
The phase (group) of each particle for collision handling.
NativeArraySimulationMeshDescriptorIndex
The index of the simulation mesh descriptor for each particle.
NativeArrayPositionCorrections
The position corrections to be applied to each particle.
NativeArrayPositionCorrectionsCount
The count of position corrections for each particle.
NativeArrayParticleLocks
The locks array used for atomic operations on particles.
Methods¶
void Create(
in int size,
NativeArrayOptions nativeArrayOptions = NativeArrayOptions.ClearMemory
)
Initializes the particle data arrays.
Parameters:
size |
The size of the arrays. |
nativeArrayOptions |
Options for array memory initialization. |
int Resize(in int newSize)
Resizes the data arrays.
Parameters:
newSize |
The new size. |
Returns:
The old size before resizing.
int InsertAdditionalEmptySpace(in int additionalSize, in int emptySpacePosition)
Inserts additional empty space into the data arrays.
Parameters:
additionalSize |
The size of the additional space to insert. |
emptySpacePosition |
The index at which the new empty space will be located. |
Returns:
The index at which the new cells begin.
void RemoveRange(in int index, in int length)
Removes a range of data from the arrays.
Parameters:
index |
The starting index of the range to remove. |
length |
The length of the range to remove. |
void Dispose()
Disposes of the native arrays.