Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
SoftBodyCreationSettings.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2023 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
12
14
18{
19public:
21
22
24 SoftBodyCreationSettings(const SoftBodySharedSettings *inSettings, RVec3Arg inPosition, QuatArg inRotation, ObjectLayer inObjectLayer) : mSettings(inSettings), mPosition(inPosition), mRotation(inRotation), mObjectLayer(inObjectLayer) { }
25
27 void SaveBinaryState(StreamOut &inStream) const;
28
30 void RestoreBinaryState(StreamIn &inStream);
31
38
42 void SaveWithChildren(StreamOut &inStream, SharedSettingsToIDMap *ioSharedSettingsMap, MaterialToIDMap *ioMaterialMap, GroupFilterToIDMap *ioGroupFilterMap) const;
43
45
47 static SBCSResult sRestoreWithChildren(StreamIn &inStream, IDToSharedSettingsMap &ioSharedSettingsMap, IDToMaterialMap &ioMaterialMap, IDToGroupFilterMap &ioGroupFilterMap);
48
50
51 RVec3 mPosition { RVec3::sZero() };
52 Quat mRotation { Quat::sIdentity() };
53
55 uint64 mUserData = 0;
56
58 ObjectLayer mObjectLayer = 0;
60
61 uint32 mNumIterations = 5;
62 float mLinearDamping = 0.1f;
63 float mMaxLinearVelocity = 500.0f;
64 float mRestitution = 0.0f;
65 float mFriction = 0.2f;
66 float mPressure = 0.0f;
67 float mGravityFactor = 1.0f;
68 bool mUpdatePosition = true;
69 bool mMakeRotationIdentity = true;
70 bool mAllowSleeping = true;
71};
72
#define JPH_EXPORT
Definition: Core.h:227
std::uint64_t uint64
Definition: Core.h:443
#define JPH_NAMESPACE_END
Definition: Core.h:367
std::uint32_t uint32
Definition: Core.h:442
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:361
uint16 ObjectLayer
Definition: ObjectLayer.h:16
#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(linkage, class_name)
Definition: SerializableObject.h:71
Definition: CollisionGroup.h:20
Definition: Quat.h:33
static JPH_INLINE Quat sIdentity()
Definition: Quat.h:103
Definition: Reference.h:151
Helper class that either contains a valid result or an error.
Definition: Result.h:15
Definition: SoftBodyCreationSettings.h:18
SoftBodySharedSettings::SharedSettingsToIDMap SharedSettingsToIDMap
Definition: SoftBodyCreationSettings.h:34
StreamUtils::IDToObjectMap< PhysicsMaterial > IDToMaterialMap
Definition: SoftBodyCreationSettings.h:37
StreamUtils::ObjectToIDMap< GroupFilter > GroupFilterToIDMap
Definition: SoftBodyCreationSettings.h:32
SoftBodySharedSettings::IDToSharedSettingsMap IDToSharedSettingsMap
Definition: SoftBodyCreationSettings.h:35
StreamUtils::ObjectToIDMap< PhysicsMaterial > MaterialToIDMap
Definition: SoftBodyCreationSettings.h:36
StreamUtils::IDToObjectMap< GroupFilter > IDToGroupFilterMap
Definition: SoftBodyCreationSettings.h:33
RefConst< SoftBodySharedSettings > mSettings
Defines the configuration of this soft body.
Definition: SoftBodyCreationSettings.h:49
CollisionGroup mCollisionGroup
The collision group this body belongs to (determines if two objects can collide)
Definition: SoftBodyCreationSettings.h:59
Definition: SoftBodySharedSettings.h:16
StreamUtils::IDToObjectMap< SoftBodySharedSettings > IDToSharedSettingsMap
Definition: SoftBodySharedSettings.h:99
StreamUtils::ObjectToIDMap< SoftBodySharedSettings > SharedSettingsToIDMap
Definition: SoftBodySharedSettings.h:98
Simple binary input stream.
Definition: StreamIn.h:13
Simple binary output stream.
Definition: StreamOut.h:13
Definition: Vec3.h:16
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition: Vec3.inl:107
Array< Ref< Type > > IDToObjectMap
Definition: StreamUtils.h:21
UnorderedMap< const Type *, uint32 > ObjectToIDMap
Definition: StreamUtils.h:18