14 class CharacterGroundConstraintContainerTest;
25 class FCharacterGroundConstraintContainer;
28 class FCharacterGroundConstraintContainerSolver;
59 virtual bool IsEnabled()
const {
return !bDisabled; }
68 if (!CharacterParticle || bDisabled)
98 SetDirtyFlag(EDirtyDataFlags::Data);
104 SetDirtyFlag(EDirtyDataFlags::Settings);
109 SetDirtyFlag(EDirtyDataFlags::Settings);
142 LocalCharacterPosition = ComputeLocalCharacterPosition();
144 SetDirtyFlag(EDirtyDataFlags::GroundParticle);
156 return IsFlagSet(EDirtyDataFlags::GroundParticle);
161 return IsFlagSet(EDirtyDataFlags::Settings);
166 return IsFlagSet(EDirtyDataFlags::Data);
180 enum class EDirtyDataFlags :
uint8
182 GroundParticle = 1 << 0,
187 bool IsFlagSet(EDirtyDataFlags Flag)
const
189 return (DirtyFlags & (
uint8)Flag) == (
uint8)Flag;
191 void SetDirtyFlag(EDirtyDataFlags Flag)
193 DirtyFlags |= (
uint8)Flag;
196 FVec3 ComputeLocalCharacterPosition()
198 if (!CharacterParticle || bDisabled)
200 return FVec3::ZeroVector;
213 FCharacterGroundConstraintSettings Settings;
214 FCharacterGroundConstraintDynamicData Data;
215 FVec3 SolverAppliedForce = FVec3::ZeroVector;
216 FVec3 SolverAppliedTorque = FVec3::ZeroVector;
217 FVec3 LocalCharacterPosition = FVec3::ZeroVector;
220 bool bDisabled =
false;
221 bool bEnabledDuringResim;
constexpr auto MakeArrayView(OtherRangeType &&Other)
Definition ArrayView.h:873
#define check(expr)
Definition AssertionMacros.h:314
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Container class for all character ground constraints on the physics thread.
Definition CharacterGroundConstraintContainer.h:228
int32 NumConstraints() const
Definition CharacterGroundConstraintContainer.h:237
FConstConstraints GetConstConstraints() const
Definition CharacterGroundConstraintContainer.h:248
CHAOS_API FCharacterGroundConstraintContainer()
Definition CharacterGroundConstraintContainer.cpp:19
FCharacterGroundConstraintHandle * GetConstraint(int32 ConstraintIndex)
Definition CharacterGroundConstraintContainer.h:250
CHAOS_API void RemoveConstraint(FCharacterGroundConstraintHandle *Constraint)
Definition CharacterGroundConstraintContainer.cpp:79
virtual int32 GetNumConstraints() const override final
Definition CharacterGroundConstraintContainer.h:257
virtual CHAOS_API void AddConstraintsToGraph(Private::FPBDIslandManager &IslandManager) override final
Definition CharacterGroundConstraintContainer.cpp:107
CHAOS_API FCharacterGroundConstraintHandle * AddConstraint(const FCharacterGroundConstraintSettings &InConstraintSettings, const FCharacterGroundConstraintDynamicData &InConstraintData, FGeometryParticleHandle *CharacterParticle, FGeometryParticleHandle *GroundParticle=nullptr)
Definition CharacterGroundConstraintContainer.cpp:50
virtual CHAOS_API ~FCharacterGroundConstraintContainer()
Definition CharacterGroundConstraintContainer.cpp:25
bool IsConstraintEnabled(int32 ConstraintIndex) const
Definition CharacterGroundConstraintContainer.h:269
virtual CHAOS_API void PrepareTick() override final
Definition CharacterGroundConstraintContainer.cpp:131
const FCharacterGroundConstraintHandle * GetConstraint(int32 ConstraintIndex) const
Definition CharacterGroundConstraintContainer.h:251
CHAOS_API void SetConstraintEnabled(int32 ConstraintIndex, bool bEnabled)
Definition CharacterGroundConstraintContainer.cpp:29
virtual CHAOS_API TUniquePtr< FConstraintContainerSolver > CreateGroupSolver(const int32 Priority) override final
Definition CharacterGroundConstraintContainer.cpp:102
virtual CHAOS_API void UnprepareTick() override final
Definition CharacterGroundConstraintContainer.cpp:135
virtual void ResetConstraints() override final
Definition CharacterGroundConstraintContainer.h:258
virtual CHAOS_API TUniquePtr< FConstraintContainerSolver > CreateSceneSolver(const int32 Priority) override final
Definition CharacterGroundConstraintContainer.cpp:97
virtual CHAOS_API void OnDisableParticle(FGeometryParticleHandle *DisabledParticle) override final
Definition CharacterGroundConstraintContainer.cpp:176
virtual CHAOS_API void OnEnableParticle(FGeometryParticleHandle *EnabledParticle) override final
Definition CharacterGroundConstraintContainer.cpp:205
FConstraints GetConstraints()
Definition CharacterGroundConstraintContainer.h:247
virtual CHAOS_API void DisconnectConstraints(const TSet< TGeometryParticleHandle< FReal, 3 > * > &RemovedParticles) override final
Definition CharacterGroundConstraintContainer.cpp:139
Definition CharacterGroundConstraintSettings.h:32
FVec3 TargetDeltaPosition
World space ground normal.
Definition CharacterGroundConstraintSettings.h:40
Definition CharacterGroundConstraintContainer.h:35
virtual bool IsEnabled() const
Definition CharacterGroundConstraintContainer.h:59
const FCharacterGroundConstraintDynamicData & GetData() const
Definition CharacterGroundConstraintContainer.h:64
FCharacterGroundConstraintHandle()
Definition CharacterGroundConstraintContainer.h:40
void SetGroundParticle(FGeometryParticleHandle *InGroundParticle)
Definition CharacterGroundConstraintContainer.h:118
bool GetEnabledDuringResim() const
Definition CharacterGroundConstraintContainer.h:55
void SetEnabledDuringResim(bool bEnabled)
Definition CharacterGroundConstraintContainer.h:56
FCharacterGroundConstraintSettings & GetSettings_Mutable()
Definition CharacterGroundConstraintContainer.h:107
void SetData(const FCharacterGroundConstraintDynamicData &InData)
Definition CharacterGroundConstraintContainer.h:66
FVec3 GetSolverAppliedForce() const
Definition CharacterGroundConstraintContainer.h:149
virtual void SetEnabled(bool InEnabled) override
Definition CharacterGroundConstraintContainer.h:58
bool HaveSettingsChanged() const
Definition CharacterGroundConstraintContainer.h:159
ESyncState GetSyncState() const
Definition CharacterGroundConstraintContainer.h:51
friend class ChaosTest::CharacterGroundConstraintContainerTest
Definition CharacterGroundConstraintContainer.h:178
virtual FParticlePair GetConstrainedParticles() const override final
Definition CharacterGroundConstraintContainer.h:114
friend class FCharacterGroundConstraintContainer
Definition CharacterGroundConstraintContainer.h:175
bool HasGroundParticleChanged() const
Definition CharacterGroundConstraintContainer.h:154
const FCharacterGroundConstraintSettings & GetSettings() const
Definition CharacterGroundConstraintContainer.h:63
void SetSyncState(ESyncState InSyncState)
Definition CharacterGroundConstraintContainer.h:52
static const FConstraintHandleTypeID & StaticType()
Definition CharacterGroundConstraintContainer.h:45
FVec3 GetSolverAppliedTorque() const
Definition CharacterGroundConstraintContainer.h:152
void SetSettings(const FCharacterGroundConstraintSettings &InSettings)
Definition CharacterGroundConstraintContainer.h:101
FGeometryParticleHandle * GetCharacterParticle() const
Definition CharacterGroundConstraintContainer.h:115
void ClearDirtyFlags()
Definition CharacterGroundConstraintContainer.h:169
FGeometryParticleHandle * GetGroundParticle() const
Definition CharacterGroundConstraintContainer.h:116
EResimType GetResimType() const
Definition CharacterGroundConstraintContainer.h:54
bool HasDataChanged() const
Definition CharacterGroundConstraintContainer.h:164
Definition CharacterGroundConstraintProxy.h:18
Definition CharacterGroundConstraintSettings.h:9
A type id for constraint handles to support safe up/down casting (including intermediate classes in t...
Definition ConstraintHandle.h:49
static const FConstraintHandleTypeID & StaticType()
Definition IndexedConstraintContainer.h:50
Definition PBDConstraintContainer.h:19
Definition CharacterGroundConstraintContainerSolver.h:13
Definition IslandManager.h:453
Definition ParticleHandle.h:436
void AddConstraintHandle(FConstraintHandle *InConstraintHandle)
Definition ParticleHandle.h:837
void RemoveConstraintHandle(FConstraintHandle *InConstraintHandle)
Definition ParticleHandle.h:842
const TPBDRigidParticleHandleImp< T, d, bPersistent > * CastToRigidParticle() const
Definition ParticleHandle.h:1697
const TVector< T, d > & GetX() const
Definition ParticleHandle.h:558
const TRotation< T, d > GetR() const
Definition ParticleHandle.h:568
Base class for constraints that are allocated at permanent memory addresses and inherit the handle.
Definition ConstraintHandle.h:256
Definition ObjectPool.h:25
Definition ParticleHandle.h:987
Definition Constraints.Build.cs:6
Definition ArrayView.h:139
Definition UniquePtr.h:107
Definition CharacterGroundConstraintContainer.h:13
float Chaos_CharacterGroundConstraint_ExternalMovementThreshold
Definition CharacterGroundConstraintContainer.cpp:15
float Chaos_CharacterGroundConstraint_InputMovementThreshold
Definition CharacterGroundConstraintContainer.cpp:12
Definition SkeletalMeshComponent.h:307
ESyncState
Definition GeometryParticlesfwd.h:29
EResimType
Definition GeometryParticles.h:143
FRealDouble FReal
Definition Real.h:22
TVector< FReal, 3 > FVec3
Definition Core.h:17
TGeometryParticleHandle< FReal, 3 > FGeometryParticleHandle
Definition ParticleHandleFwd.h:24
Definition OverriddenPropertySet.cpp:45