Jolt Physics
A multi core friendly Game Physics Engine
|
Contains the creation settings of a set of bodies. More...
#include <PhysicsScene.h>
Classes | |
class | ConnectedConstraint |
A constraint and how it is connected to the bodies in the scene. More... | |
Public Types | |
using | PhysicsSceneResult = Result< Ref< PhysicsScene > > |
Public Member Functions | |
void | AddBody (const BodyCreationSettings &inBody) |
Add a body to the scene. More... | |
void | AddConstraint (const TwoBodyConstraintSettings *inConstraint, uint32 inBody1, uint32 inBody2) |
void | AddSoftBody (const SoftBodyCreationSettings &inSoftBody) |
Add a soft body to the scene. More... | |
size_t | GetNumBodies () const |
Get number of bodies in this scene. More... | |
const Array< BodyCreationSettings > & | GetBodies () const |
Access to the body settings for this scene. More... | |
Array< BodyCreationSettings > & | GetBodies () |
size_t | GetNumConstraints () const |
Get number of constraints in this scene. More... | |
const Array< ConnectedConstraint > & | GetConstraints () const |
Access to the constraints for this scene. More... | |
Array< ConnectedConstraint > & | GetConstraints () |
size_t | GetNumSoftBodies () const |
Get number of bodies in this scene. More... | |
const Array< SoftBodyCreationSettings > & | GetSoftBodies () const |
Access to the soft body settings for this scene. More... | |
Array< SoftBodyCreationSettings > & | GetSoftBodies () |
bool | CreateBodies (PhysicsSystem *inSystem) const |
Instantiate all bodies, returns false if not all bodies could be created. More... | |
bool | FixInvalidScales () |
void | SaveBinaryState (StreamOut &inStream, bool inSaveShapes, bool inSaveGroupFilter) const |
void | FromPhysicsSystem (const PhysicsSystem *inSystem) |
For debugging purposes: Construct a scene from the current state of the physics system. More... | |
Public Member Functions inherited from RefTarget< PhysicsScene > | |
RefTarget ()=default | |
Constructor. More... | |
RefTarget (const RefTarget &) | |
~RefTarget () | |
assert no one is referencing us More... | |
void | SetEmbedded () const |
RefTarget & | operator= (const RefTarget &) |
Assignment operator. More... | |
uint32 | GetRefCount () const |
Get current refcount of this object. More... | |
void | AddRef () const |
Add or release a reference to this object. More... | |
void | Release () const |
Static Public Member Functions | |
static PhysicsSceneResult | sRestoreFromBinaryState (StreamIn &inStream) |
Restore a saved scene from inStream. More... | |
Static Public Member Functions inherited from RefTarget< PhysicsScene > | |
static int | sInternalGetRefCountOffset () |
INTERNAL HELPER FUNCTION USED BY SERIALIZATION. More... | |
Static Public Attributes | |
static constexpr uint32 | cFixedToWorld = 0xffffffff |
Body constant to use to indicate that the constraint is attached to the fixed world. More... | |
Additional Inherited Members | |
Protected Attributes inherited from RefTarget< PhysicsScene > | |
atomic< uint32 > | mRefCount |
Current reference count. More... | |
Static Protected Attributes inherited from RefTarget< PhysicsScene > | |
static constexpr uint32 | cEmbedded |
A large value that gets added to the refcount to mark the object as embedded. More... | |
Contains the creation settings of a set of bodies.
using PhysicsScene::PhysicsSceneResult = Result<Ref<PhysicsScene> > |
void PhysicsScene::AddBody | ( | const BodyCreationSettings & | inBody | ) |
Add a body to the scene.
void PhysicsScene::AddConstraint | ( | const TwoBodyConstraintSettings * | inConstraint, |
uint32 | inBody1, | ||
uint32 | inBody2 | ||
) |
Add a constraint to the scene
inConstraint | Constraint settings |
inBody1 | Index in the bodies list of first body to attach constraint to |
inBody2 | Index in the bodies list of the second body to attach constraint to |
void PhysicsScene::AddSoftBody | ( | const SoftBodyCreationSettings & | inSoftBody | ) |
Add a soft body to the scene.
bool PhysicsScene::CreateBodies | ( | PhysicsSystem * | inSystem | ) | const |
Instantiate all bodies, returns false if not all bodies could be created.
bool PhysicsScene::FixInvalidScales | ( | ) |
Go through all body creation settings and fix shapes that are scaled incorrectly (note this will change the scene a bit).
void PhysicsScene::FromPhysicsSystem | ( | const PhysicsSystem * | inSystem | ) |
For debugging purposes: Construct a scene from the current state of the physics system.
|
inline |
|
inline |
Access to the body settings for this scene.
|
inline |
|
inline |
Access to the constraints for this scene.
|
inline |
Get number of bodies in this scene.
|
inline |
Get number of constraints in this scene.
|
inline |
Get number of bodies in this scene.
|
inline |
|
inline |
Access to the soft body settings for this scene.
void PhysicsScene::SaveBinaryState | ( | StreamOut & | inStream, |
bool | inSaveShapes, | ||
bool | inSaveGroupFilter | ||
) | const |
Saves the state of this object in binary form to inStream.
inStream | The stream to save the state to |
inSaveShapes | If the shapes should be saved as well (these could be shared between physics scenes, in which case the calling application may want to write custom code to restore them) |
inSaveGroupFilter | If the group filter should be saved as well (these could be shared) |
|
static |
Restore a saved scene from inStream.
|
staticconstexpr |
Body constant to use to indicate that the constraint is attached to the fixed world.