initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
59
thirdparty/jolt_physics/Jolt/Physics/Character/CharacterBase.cpp
vendored
Normal file
59
thirdparty/jolt_physics/Jolt/Physics/Character/CharacterBase.cpp
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
||||
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include <Jolt/Jolt.h>
|
||||
|
||||
#include <Jolt/Physics/Character/CharacterBase.h>
|
||||
#include <Jolt/Physics/StateRecorder.h>
|
||||
|
||||
JPH_NAMESPACE_BEGIN
|
||||
|
||||
CharacterBase::CharacterBase(const CharacterBaseSettings *inSettings, PhysicsSystem *inSystem) :
|
||||
mSystem(inSystem),
|
||||
mShape(inSettings->mShape),
|
||||
mUp(inSettings->mUp),
|
||||
mSupportingVolume(inSettings->mSupportingVolume)
|
||||
{
|
||||
// Initialize max slope angle
|
||||
SetMaxSlopeAngle(inSettings->mMaxSlopeAngle);
|
||||
}
|
||||
|
||||
const char *CharacterBase::sToString(EGroundState inState)
|
||||
{
|
||||
switch (inState)
|
||||
{
|
||||
case EGroundState::OnGround: return "OnGround";
|
||||
case EGroundState::OnSteepGround: return "OnSteepGround";
|
||||
case EGroundState::NotSupported: return "NotSupported";
|
||||
case EGroundState::InAir: return "InAir";
|
||||
}
|
||||
|
||||
JPH_ASSERT(false);
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
void CharacterBase::SaveState(StateRecorder &inStream) const
|
||||
{
|
||||
inStream.Write(mGroundState);
|
||||
inStream.Write(mGroundBodyID);
|
||||
inStream.Write(mGroundBodySubShapeID);
|
||||
inStream.Write(mGroundPosition);
|
||||
inStream.Write(mGroundNormal);
|
||||
inStream.Write(mGroundVelocity);
|
||||
// Can't save user data (may be a pointer) and material
|
||||
}
|
||||
|
||||
void CharacterBase::RestoreState(StateRecorder &inStream)
|
||||
{
|
||||
inStream.Read(mGroundState);
|
||||
inStream.Read(mGroundBodyID);
|
||||
inStream.Read(mGroundBodySubShapeID);
|
||||
inStream.Read(mGroundPosition);
|
||||
inStream.Read(mGroundNormal);
|
||||
inStream.Read(mGroundVelocity);
|
||||
mGroundUserData = 0; // Cannot restore user data
|
||||
mGroundMaterial = PhysicsMaterial::sDefault; // Cannot restore material
|
||||
}
|
||||
|
||||
JPH_NAMESPACE_END
|
Reference in New Issue
Block a user