#pragma once #include "src/Core/Core.h" #include "src/Core/Maths.h" #include "src/Core/Physics/PhysicsShapes.h" #include "src/Scene/Entities/Entity.h" namespace Nuake { class Entity; namespace Physics { class CharacterController { public: Vector3 Position; Entity Owner; bool IsOnGround = false; bool m_hittingWall; float m_stepHeight = 0.35f; float MaxSlopeAngle = 45.0f; float Friction = 0.5f; Ref Shape; //bool m_onJumpableGround; // A bit lower contact than just onGround float m_bottomYOffset; float m_bottomRoundedRegionYOffset; glm::vec3 m_manualVelocity; std::vector m_surfaceHitNormals; CharacterController(const Ref& shape, float friction, float maxSlopeAngle); void SetEntity(Entity& ent); Entity GetEntity() const; void MoveAndSlide(glm::vec3 velocity); bool IsOnFloor() { return IsOnGround; } private: void ParseGhostContacts(); void UpdatePosition(); void UpdateVelocity(); }; } }