Continue Jolt integration
This commit is contained in:
committed by
Jérôme Leclercq
parent
21e08798ce
commit
021801f02e
59
include/Nazara/JoltPhysics3D/JoltCharacter.hpp
Normal file
59
include/Nazara/JoltPhysics3D/JoltCharacter.hpp
Normal file
@@ -0,0 +1,59 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - JoltPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_JOLTPHYSICS3D_JOLTCHARACTER_HPP
|
||||
#define NAZARA_JOLTPHYSICS3D_JOLTCHARACTER_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/JoltPhysics3D/Config.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace JPH
|
||||
{
|
||||
class Character;
|
||||
}
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class JoltCollider3D;
|
||||
class JoltPhysWorld3D;
|
||||
|
||||
class NAZARA_JOLTPHYSICS3D_API JoltCharacter
|
||||
{
|
||||
friend JoltPhysWorld3D;
|
||||
|
||||
public:
|
||||
JoltCharacter(JoltPhysWorld3D& physWorld, std::shared_ptr<JoltCollider3D> collider, const Vector3f& position, const Quaternionf& rotation = Quaternionf::Identity());
|
||||
JoltCharacter(const JoltCharacter&) = delete;
|
||||
JoltCharacter(JoltCharacter&&) = delete;
|
||||
~JoltCharacter();
|
||||
|
||||
Vector3f GetLinearVelocity() const;
|
||||
Quaternionf GetRotation() const;
|
||||
Vector3f GetPosition() const;
|
||||
std::pair<Vector3f, Quaternionf> GetPositionAndRotation() const;
|
||||
|
||||
bool IsOnGround() const;
|
||||
|
||||
void SetLinearVelocity(const Vector3f& linearVel);
|
||||
|
||||
JoltCharacter& operator=(const JoltCharacter&) = delete;
|
||||
JoltCharacter& operator=(JoltCharacter&&) = delete;
|
||||
|
||||
private:
|
||||
void PostSimulate();
|
||||
|
||||
std::shared_ptr<JoltCollider3D> m_collider;
|
||||
std::unique_ptr<JPH::Character> m_character;
|
||||
JoltPhysWorld3D& m_physicsWorld;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/JoltPhysics3D/JoltCharacter.inl>
|
||||
|
||||
#endif // NAZARA_JOLTPHYSICS3D_JOLTCHARACTER_HPP
|
||||
Reference in New Issue
Block a user