48 const Shape * GetShape()
const;
49 void SetShape(
const Shape *inShape) { mShapePtr = inShape; mShape =
nullptr; }
58 void SaveBinaryState(
StreamOut &inStream)
const;
61 void RestoreBinaryState(
StreamIn &inStream);
EAllowedDOFs
Enum used in BodyCreationSettings and MotionProperties to indicate which degrees of freedom a body ha...
Definition AllowedDOFs.h:11
@ All
All degrees of freedom are allowed.
Definition AllowedDOFs.h:13
EOverrideMassProperties
Enum used in BodyCreationSettings to indicate how mass and inertia should be calculated.
Definition BodyCreationSettings.h:23
@ CalculateInertia
Tells the system to take the mass from mMassPropertiesOverride and to calculate the inertia based on ...
Definition BodyCreationSettings.h:25
@ MassAndInertiaProvided
Tells the system to take the mass and inertia from mMassPropertiesOverride.
Definition BodyCreationSettings.h:26
@ CalculateMassAndInertia
Tells the system to calculate the mass and inertia based on density.
Definition BodyCreationSettings.h:24
std::uint8_t uint8
Definition Core.h:501
#define JPH_EXPORT
Definition Core.h:275
std::uint64_t uint64
Definition Core.h:504
unsigned int uint
Definition Core.h:500
#define JPH_NAMESPACE_END
Definition Core.h:425
#define JPH_NAMESPACE_BEGIN
Definition Core.h:419
const Quat QuatArg
Definition MathTypes.h:28
EMotionQuality
Motion quality, or how well it detects collisions when it has a high velocity.
Definition MotionQuality.h:11
@ Discrete
Definition MotionQuality.h:14
EMotionType
Motion type of a physics body.
Definition MotionType.h:11
@ Static
Non movable.
Definition MotionType.h:12
@ Dynamic
Responds to forces as a normal physics object.
Definition MotionType.h:14
uint16 ObjectLayer
Definition ObjectLayer.h:16
Vec3Arg RVec3Arg
Definition Real.h:30
Vec3 RVec3
Definition Real.h:29
#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(linkage, class_name)
Definition SerializableObject.h:80
StreamUtils::IDToObjectMap< GroupFilter > IDToGroupFilterMap
Definition BodyCreationSettings.h:64
void SetShape(const Shape *inShape)
Definition BodyCreationSettings.h:49
StreamUtils::ObjectToIDMap< GroupFilter > GroupFilterToIDMap
Definition BodyCreationSettings.h:63
void SaveWithChildren(StreamOut &inStream, ShapeToIDMap *ioShapeMap, MaterialToIDMap *ioMaterialMap, GroupFilterToIDMap *ioGroupFilterMap) const
Definition BodyCreationSettings.cpp:184
bool mAllowSleeping
If this body can go to sleep or not.
Definition BodyCreationSettings.h:102
StreamUtils::ObjectToIDMap< PhysicsMaterial > MaterialToIDMap
Definition BodyCreationSettings.h:67
Vec3 mLinearVelocity
World space linear velocity of the center of mass (m/s).
Definition BodyCreationSettings.h:82
const ShapeSettings * GetShapeSettings() const
Access to the shape settings object. This contains serializable (non-runtime optimized) information a...
Definition BodyCreationSettings.h:41
Shape::IDToShapeMap IDToShapeMap
Definition BodyCreationSettings.h:66
Vec3 mAngularVelocity
World space angular velocity (rad/s).
Definition BodyCreationSettings.h:83
Result< BodyCreationSettings > BCSResult
Definition BodyCreationSettings.h:75
bool mEnhancedInternalEdgeRemoval
Set to indicate that extra effort should be made to try to remove ghost contacts (collisions with int...
Definition BodyCreationSettings.h:101
float mGravityFactor
Value to multiply gravity with for this body.
Definition BodyCreationSettings.h:109
float mFriction
Friction of the body (dimensionless number, usually between 0 and 1, 0 = no friction,...
Definition BodyCreationSettings.h:103
float mInertiaMultiplier
When calculating the inertia (not when it is provided) the calculated inertia will be multiplied by t...
Definition BodyCreationSettings.h:115
bool mApplyGyroscopicForce
Set to indicate that the gyroscopic force should be applied to this body (aka Dzhanibekov effect,...
Definition BodyCreationSettings.h:99
bool mUseManifoldReduction
If this body should use manifold reduction (see description at Body::SetUseManifoldReduction).
Definition BodyCreationSettings.h:98
float mMaxLinearVelocity
Maximum linear velocity that this body can reach (m/s).
Definition BodyCreationSettings.h:107
EMotionQuality mMotionQuality
Motion quality, or how well it detects collisions when it has a high velocity.
Definition BodyCreationSettings.h:100
BodyCreationSettings(const ShapeSettings *inShape, RVec3Arg inPosition, QuatArg inRotation, EMotionType inMotionType, ObjectLayer inObjectLayer)
Definition BodyCreationSettings.h:37
RVec3 mPosition
Position of the body (not of the center of mass).
Definition BodyCreationSettings.h:80
BodyCreationSettings(const Shape *inShape, RVec3Arg inPosition, QuatArg inRotation, EMotionType inMotionType, ObjectLayer inObjectLayer)
Definition BodyCreationSettings.h:38
bool mCollideKinematicVsNonDynamic
If kinematic objects can generate contact points against other kinematic or static objects....
Definition BodyCreationSettings.h:97
uint mNumVelocityStepsOverride
Used only when this body is dynamic and colliding. Override for the number of solver velocity iterati...
Definition BodyCreationSettings.h:110
float mMaxAngularVelocity
Maximum angular velocity that this body can reach (rad/s).
Definition BodyCreationSettings.h:108
EAllowedDOFs mAllowedDOFs
Which degrees of freedom this body has (can be used to limit simulation to 2D).
Definition BodyCreationSettings.h:94
Quat mRotation
Rotation of the body.
Definition BodyCreationSettings.h:81
bool HasMassProperties() const
Check if the mass properties of this body will be calculated (only relevant for kinematic or dynamic ...
Definition BodyCreationSettings.h:52
ObjectLayer mObjectLayer
The collision layer this body belongs to (determines if two objects can collide).
Definition BodyCreationSettings.h:89
uint mNumPositionStepsOverride
Used only when this body is dynamic and colliding. Override for the number of solver position iterati...
Definition BodyCreationSettings.h:111
EOverrideMassProperties mOverrideMassProperties
Determines how mMassPropertiesOverride will be used.
Definition BodyCreationSettings.h:114
float mAngularDamping
Angular damping: dw/dt = -c * w. c. Value should be zero or positive and is usually close to 0.
Definition BodyCreationSettings.h:106
uint64 mUserData
User data value (can be used by application).
Definition BodyCreationSettings.h:86
float mLinearDamping
Linear damping: dv/dt = -c * v. c. Value should be zero or positive and is usually close to 0.
Definition BodyCreationSettings.h:105
static BCSResult sRestoreWithChildren(StreamIn &inStream, IDToShapeMap &ioShapeMap, IDToMaterialMap &ioMaterialMap, IDToGroupFilterMap &ioGroupFilterMap)
Restore body creation settings, its shape, materials and group filter. Pass in an empty map in ioShap...
Definition BodyCreationSettings.cpp:199
float mRestitution
Restitution of body (dimensionless number, usually between 0 and 1, 0 = completely inelastic collisio...
Definition BodyCreationSettings.h:104
bool mIsSensor
If this body is a sensor. A sensor will receive collision callbacks, but will not cause any collision...
Definition BodyCreationSettings.h:96
EMotionType mMotionType
Motion type, determines if the object is static, dynamic or kinematic.
Definition BodyCreationSettings.h:93
StreamUtils::IDToObjectMap< PhysicsMaterial > IDToMaterialMap
Definition BodyCreationSettings.h:68
CollisionGroup mCollisionGroup
The collision group this body belongs to (determines if two objects can collide).
Definition BodyCreationSettings.h:90
BodyCreationSettings()=default
Constructor.
Shape::ShapeToIDMap ShapeToIDMap
Definition BodyCreationSettings.h:65
MassProperties mMassPropertiesOverride
Contains replacement mass settings which override the automatically calculated values.
Definition BodyCreationSettings.h:116
void SetShapeSettings(const ShapeSettings *inShape)
Definition BodyCreationSettings.h:42
bool mAllowDynamicOrKinematic
When this body is created as static, this setting tells the system to create a MotionProperties objec...
Definition BodyCreationSettings.h:95
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:104
Definition Reference.h:163
Helper class that either contains a valid result or an error.
Definition Result.h:12
Base class for all shapes (collision volume of a body). Defines a virtual interface for collision det...
Definition Shape.h:186
StreamUtils::IDToObjectMap< Shape > IDToShapeMap
Definition Shape.h:394
ShapeSettings::ShapeResult ShapeResult
Definition Shape.h:190
StreamUtils::ObjectToIDMap< Shape > ShapeToIDMap
Definition Shape.h:393
Simple binary input stream.
Definition StreamIn.h:13
Simple binary output stream.
Definition StreamOut.h:13
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:103
UnorderedMap< const Type *, uint32 > ObjectToIDMap
Definition StreamUtils.h:18
Array< Ref< Type > > IDToObjectMap
Definition StreamUtils.h:21