Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
SoftBodyCreationSettings Class Reference

#include <SoftBodyCreationSettings.h>

Public Types

using GroupFilterToIDMap = StreamUtils::ObjectToIDMap< GroupFilter >
 
using IDToGroupFilterMap = StreamUtils::IDToObjectMap< GroupFilter >
 
using SharedSettingsToIDMap = SoftBodySharedSettings::SharedSettingsToIDMap
 
using IDToSharedSettingsMap = SoftBodySharedSettings::IDToSharedSettingsMap
 
using MaterialToIDMap = StreamUtils::ObjectToIDMap< PhysicsMaterial >
 
using IDToMaterialMap = StreamUtils::IDToObjectMap< PhysicsMaterial >
 
using SBCSResult = Result< SoftBodyCreationSettings >
 

Public Member Functions

 SoftBodyCreationSettings ()=default
 Constructor.
 
 SoftBodyCreationSettings (const SoftBodySharedSettings *inSettings, RVec3Arg inPosition, QuatArg inRotation, ObjectLayer inObjectLayer)
 
void SaveBinaryState (StreamOut &inStream) const
 Saves the state of this object in binary form to inStream. Doesn't store the shared settings nor the group filter.
 
void RestoreBinaryState (StreamIn &inStream)
 Restore the state of this object from inStream. Doesn't restore the shared settings nor the group filter.
 
void SaveWithChildren (StreamOut &inStream, SharedSettingsToIDMap *ioSharedSettingsMap, MaterialToIDMap *ioMaterialMap, GroupFilterToIDMap *ioGroupFilterMap) const
 

Static Public Member Functions

static SBCSResult sRestoreWithChildren (StreamIn &inStream, IDToSharedSettingsMap &ioSharedSettingsMap, IDToMaterialMap &ioMaterialMap, IDToGroupFilterMap &ioGroupFilterMap)
 Restore a shape, all its children and materials. Pass in an empty map in ioSharedSettingsMap / ioMaterialMap / ioGroupFilterMap or reuse the same map while reading multiple shapes from the same stream in order to restore duplicates.
 

Public Attributes

RefConst< SoftBodySharedSettingsmSettings
 Defines the configuration of this soft body.
 
RVec3 mPosition { RVec3::sZero() }
 Initial position of the soft body.
 
Quat mRotation { Quat::sIdentity() }
 Initial rotation of the soft body.
 
uint64 mUserData = 0
 User data value (can be used by application)
 
Collision settings
ObjectLayer mObjectLayer = 0
 The collision layer this body belongs to (determines if two objects can collide)
 
CollisionGroup mCollisionGroup
 The collision group this body belongs to (determines if two objects can collide)
 
uint32 mNumIterations = 5
 Number of solver iterations.
 
float mLinearDamping = 0.1f
 Linear damping: dv/dt = -mLinearDamping * v.
 
float mMaxLinearVelocity = 500.0f
 Maximum linear velocity that a vertex can reach (m/s)
 
float mRestitution = 0.0f
 Restitution when colliding.
 
float mFriction = 0.2f
 Friction coefficient when colliding.
 
float mPressure = 0.0f
 n * R * T, amount of substance * ideal gas constant * absolute temperature, see https://en.wikipedia.org/wiki/Pressure
 
float mGravityFactor = 1.0f
 Value to multiply gravity with for this body.
 
bool mUpdatePosition = true
 Update the position of the body while simulating (set to false for something that is attached to the static world)
 
bool mMakeRotationIdentity = true
 Bake specified mRotation in the vertices and set the body rotation to identity (simulation is slightly more accurate if the rotation of a soft body is kept to identity)
 
bool mAllowSleeping = true
 If this body can go to sleep or not.
 

Detailed Description

This class contains the information needed to create a soft body object Note: Soft bodies are still in development and come with several caveats. Read the Architecture and API documentation for more information!

Member Typedef Documentation

◆ GroupFilterToIDMap

◆ IDToGroupFilterMap

◆ IDToMaterialMap

◆ IDToSharedSettingsMap

◆ MaterialToIDMap

◆ SBCSResult

◆ SharedSettingsToIDMap

Constructor & Destructor Documentation

◆ SoftBodyCreationSettings() [1/2]

SoftBodyCreationSettings::SoftBodyCreationSettings ( )
default

Constructor.

◆ SoftBodyCreationSettings() [2/2]

SoftBodyCreationSettings::SoftBodyCreationSettings ( const SoftBodySharedSettings inSettings,
RVec3Arg  inPosition,
QuatArg  inRotation,
ObjectLayer  inObjectLayer 
)
inline

Member Function Documentation

◆ RestoreBinaryState()

void SoftBodyCreationSettings::RestoreBinaryState ( StreamIn inStream)

Restore the state of this object from inStream. Doesn't restore the shared settings nor the group filter.

◆ SaveBinaryState()

void SoftBodyCreationSettings::SaveBinaryState ( StreamOut inStream) const

Saves the state of this object in binary form to inStream. Doesn't store the shared settings nor the group filter.

◆ SaveWithChildren()

void SoftBodyCreationSettings::SaveWithChildren ( StreamOut inStream,
SharedSettingsToIDMap ioSharedSettingsMap,
MaterialToIDMap ioMaterialMap,
GroupFilterToIDMap ioGroupFilterMap 
) const

Save this body creation settings, its shared settings and group filter. Pass in an empty map in ioSharedSettingsMap / ioMaterialMap / ioGroupFilterMap or reuse the same map while saving multiple shapes to the same stream in order to avoid writing duplicates. Pass nullptr to ioSharedSettingsMap and ioMaterial map to skip saving shared settings and materials Pass nullptr to ioGroupFilterMap to skip saving group filters

◆ sRestoreWithChildren()

SoftBodyCreationSettings::SBCSResult SoftBodyCreationSettings::sRestoreWithChildren ( StreamIn inStream,
IDToSharedSettingsMap ioSharedSettingsMap,
IDToMaterialMap ioMaterialMap,
IDToGroupFilterMap ioGroupFilterMap 
)
static

Restore a shape, all its children and materials. Pass in an empty map in ioSharedSettingsMap / ioMaterialMap / ioGroupFilterMap or reuse the same map while reading multiple shapes from the same stream in order to restore duplicates.

Member Data Documentation

◆ mAllowSleeping

bool SoftBodyCreationSettings::mAllowSleeping = true

If this body can go to sleep or not.

◆ mCollisionGroup

CollisionGroup SoftBodyCreationSettings::mCollisionGroup

The collision group this body belongs to (determines if two objects can collide)

◆ mFriction

float SoftBodyCreationSettings::mFriction = 0.2f

Friction coefficient when colliding.

◆ mGravityFactor

float SoftBodyCreationSettings::mGravityFactor = 1.0f

Value to multiply gravity with for this body.

◆ mLinearDamping

float SoftBodyCreationSettings::mLinearDamping = 0.1f

Linear damping: dv/dt = -mLinearDamping * v.

◆ mMakeRotationIdentity

bool SoftBodyCreationSettings::mMakeRotationIdentity = true

Bake specified mRotation in the vertices and set the body rotation to identity (simulation is slightly more accurate if the rotation of a soft body is kept to identity)

◆ mMaxLinearVelocity

float SoftBodyCreationSettings::mMaxLinearVelocity = 500.0f

Maximum linear velocity that a vertex can reach (m/s)

◆ mNumIterations

uint32 SoftBodyCreationSettings::mNumIterations = 5

Number of solver iterations.

◆ mObjectLayer

ObjectLayer SoftBodyCreationSettings::mObjectLayer = 0

The collision layer this body belongs to (determines if two objects can collide)

◆ mPosition

RVec3 SoftBodyCreationSettings::mPosition { RVec3::sZero() }

Initial position of the soft body.

◆ mPressure

float SoftBodyCreationSettings::mPressure = 0.0f

n * R * T, amount of substance * ideal gas constant * absolute temperature, see https://en.wikipedia.org/wiki/Pressure

◆ mRestitution

float SoftBodyCreationSettings::mRestitution = 0.0f

Restitution when colliding.

◆ mRotation

Quat SoftBodyCreationSettings::mRotation { Quat::sIdentity() }

Initial rotation of the soft body.

◆ mSettings

RefConst<SoftBodySharedSettings> SoftBodyCreationSettings::mSettings

Defines the configuration of this soft body.

◆ mUpdatePosition

bool SoftBodyCreationSettings::mUpdatePosition = true

Update the position of the body while simulating (set to false for something that is attached to the static world)

◆ mUserData

uint64 SoftBodyCreationSettings::mUserData = 0

User data value (can be used by application)


The documentation for this class was generated from the following files: