47 void SetShape(
const Shape *inShape) { mShapePtr = inShape; mShape =
nullptr; }
EOverrideMassProperties
Enum used in BodyCreationSettings to indicate how mass and inertia should be calculated.
Definition: BodyCreationSettings.h:21
@ CalculateInertia
Tells the system to take the mass from mMassPropertiesOverride and to calculate the inertia based on ...
@ MassAndInertiaProvided
Tells the system to take the mass and inertia from mMassPropertiesOverride.
@ CalculateMassAndInertia
Tells the system to calculate the mass and inertia based on density.
#define JPH_NAMESPACE_END
Definition: Core.h:240
uint8_t uint8
Definition: Core.h:310
uint64_t uint64
Definition: Core.h:313
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:234
EMotionQuality
Motion quality, or how well it detects collisions when it has a high velocity.
Definition: MotionQuality.h:11
EMotionType
Motion type of a physics body.
Definition: MotionType.h:11
uint16 ObjectLayer
Definition: ObjectLayer.h:16
std::vector< T, STLAllocator< T > > Array
Definition: STLAllocator.h:81
#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(class_name)
Definition: SerializableObject.h:71
std::unordered_map< Key, T, Hash, KeyEqual, STLAllocator< pair< const Key, T > > > UnorderedMap
Definition: UnorderedMap.h:13
Settings for constructing a rigid body.
Definition: BodyCreationSettings.h:29
void SetShape(const Shape *inShape)
Definition: BodyCreationSettings.h:47
void SaveWithChildren(StreamOut &inStream, ShapeToIDMap *ioShapeMap, MaterialToIDMap *ioMaterialMap, GroupFilterToIDMap *ioGroupFilterMap) const
Definition: BodyCreationSettings.cpp:166
bool mAllowSleeping
If this body can go to sleep or not.
Definition: BodyCreationSettings.h:96
void RestoreBinaryState(StreamIn &inStream)
Restore the state of this object from inStream. Doesn't restore the shape nor the group filter.
Definition: BodyCreationSettings.cpp:68
Array< RefConst< GroupFilter > > IDToGroupFilterMap
Definition: BodyCreationSettings.h:62
Vec3 mLinearVelocity
World space linear velocity of the center of mass (m/s)
Definition: BodyCreationSettings.h:80
const ShapeSettings * GetShapeSettings() const
Access to the shape settings object. This contains serializable (non-runtime optimized) information a...
Definition: BodyCreationSettings.h:39
Shape::IDToShapeMap IDToShapeMap
Definition: BodyCreationSettings.h:64
Vec3 mAngularVelocity
World space angular velocity (rad/s)
Definition: BodyCreationSettings.h:81
float mGravityFactor
Value to multiply gravity with for this body.
Definition: BodyCreationSettings.h:103
float mFriction
Friction of the body (dimensionless number, usually between 0 and 1, 0 = no friction,...
Definition: BodyCreationSettings.h:97
UnorderedMap< const GroupFilter *, uint32 > GroupFilterToIDMap
Definition: BodyCreationSettings.h:61
float mInertiaMultiplier
When calculating the inertia (not when it is provided) the calculated inertia will be multiplied by t...
Definition: BodyCreationSettings.h:107
bool mUseManifoldReduction
If this body should use manifold reduction (see description at Body::SetUseManifoldReduction)
Definition: BodyCreationSettings.h:94
float mMaxLinearVelocity
Maximum linear velocity that this body can reach (m/s)
Definition: BodyCreationSettings.h:101
EMotionQuality mMotionQuality
Motion quality, or how well it detects collisions when it has a high velocity.
Definition: BodyCreationSettings.h:95
Shape::IDToMaterialMap IDToMaterialMap
Definition: BodyCreationSettings.h:66
RVec3 mPosition
Position of the body (not of the center of mass)
Definition: BodyCreationSettings.h:78
BodyCreationSettings(const Shape *inShape, RVec3Arg inPosition, QuatArg inRotation, EMotionType inMotionType, ObjectLayer inObjectLayer)
Definition: BodyCreationSettings.h:36
float mMaxAngularVelocity
Maximum angular velocity that this body can reach (rad/s)
Definition: BodyCreationSettings.h:102
Quat mRotation
Rotation of the body.
Definition: BodyCreationSettings.h:79
bool HasMassProperties() const
Check if the mass properties of this body will be calculated (only relevant for kinematic or dynamic ...
Definition: BodyCreationSettings.h:50
ObjectLayer mObjectLayer
The collision layer this body belongs to (determines if two objects can collide)
Definition: BodyCreationSettings.h:87
Shape::MaterialToIDMap MaterialToIDMap
Definition: BodyCreationSettings.h:65
void SaveBinaryState(StreamOut &inStream) const
Saves the state of this object in binary form to inStream. Doesn't store the shape nor the group filt...
Definition: BodyCreationSettings.cpp:42
EOverrideMassProperties mOverrideMassProperties
Determines how mMassPropertiesOverride will be used.
Definition: BodyCreationSettings.h:106
const Shape * GetShape() const
Access to the run-time shape object. Will convert from ShapeSettings object if needed.
Definition: BodyCreationSettings.cpp:122
Shape::ShapeResult ConvertShapeSettings()
Convert ShapeSettings object into a Shape object. This will free the ShapeSettings object and make th...
Definition: BodyCreationSettings.cpp:94
float mAngularDamping
Angular damping: dw/dt = -c * w. c must be between 0 and 1 but is usually close to 0.
Definition: BodyCreationSettings.h:100
uint64 mUserData
User data value (can be used by application)
Definition: BodyCreationSettings.h:84
MassProperties GetMassProperties() const
Calculate (or return when overridden) the mass and inertia for this body.
Definition: BodyCreationSettings.cpp:142
float mLinearDamping
Linear damping: dv/dt = -c * v. c must be between 0 and 1 but is usually close to 0.
Definition: BodyCreationSettings.h:99
static BCSResult sRestoreWithChildren(StreamIn &inStream, IDToShapeMap &ioShapeMap, IDToMaterialMap &ioMaterialMap, IDToGroupFilterMap &ioGroupFilterMap)
Restore a shape, all its children and materials. Pass in an empty map in ioShapeMap / ioMaterialMap /...
Definition: BodyCreationSettings.cpp:205
float mRestitution
Restitution of body (dimensionless number, usually between 0 and 1, 0 = completely inelastic collisio...
Definition: BodyCreationSettings.h:98
bool mIsSensor
If this body is a sensor. A sensor will receive collision callbacks, but will not cause any collision...
Definition: BodyCreationSettings.h:93
EMotionType mMotionType
Motion type, determines if the object is static, dynamic or kinematic.
Definition: BodyCreationSettings.h:91
CollisionGroup mCollisionGroup
The collision group this body belongs to (determines if two objects can collide)
Definition: BodyCreationSettings.h:88
Shape::ShapeToIDMap ShapeToIDMap
Definition: BodyCreationSettings.h:63
MassProperties mMassPropertiesOverride
Contains replacement mass settings which override the automatically calculated values.
Definition: BodyCreationSettings.h:108
void SetShapeSettings(const ShapeSettings *inShape)
Definition: BodyCreationSettings.h:40
bool mAllowDynamicOrKinematic
When this body is created as static, this setting tells the system to create a MotionProperties objec...
Definition: BodyCreationSettings.h:92
Definition: CollisionGroup.h:20
Describes the mass and inertia properties of a body. Used during body construction only.
Definition: MassProperties.h:16
static JPH_INLINE Quat sIdentity()
Definition: Quat.h:93
Definition: Reference.h:154
Base class for all shapes (collision volume of a body). Defines a virtual interface for collision det...
Definition: Shape.h:170
Array< Ref< Shape > > IDToShapeMap
Definition: Shape.h:364
Array< Ref< PhysicsMaterial > > IDToMaterialMap
Definition: Shape.h:365
UnorderedMap< const Shape *, uint32 > ShapeToIDMap
Definition: Shape.h:362
UnorderedMap< const PhysicsMaterial *, uint32 > MaterialToIDMap
Definition: Shape.h:363
Simple binary input stream.
Definition: StreamIn.h:11
Simple binary output stream.
Definition: StreamOut.h:11
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition: Vec3.inl:107