mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 15:03:27 +00:00
removed usless code added constexpr
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace omath::pathfinding
|
||||
{
|
||||
class Astar
|
||||
class Astar final
|
||||
{
|
||||
public:
|
||||
[[nodiscard]]
|
||||
|
||||
@@ -12,19 +12,12 @@
|
||||
|
||||
namespace omath::pathfinding
|
||||
{
|
||||
struct NavigationVertex
|
||||
{
|
||||
Vector3 origin;
|
||||
std::vector<NavigationVertex*> connections;
|
||||
};
|
||||
|
||||
|
||||
class NavigationMesh final
|
||||
{
|
||||
public:
|
||||
|
||||
[[nodiscard]]
|
||||
std::expected<Vector3, std::string> GetClossestVertex(const Vector3& point) const;
|
||||
std::expected<Vector3, std::string> GetClosestVertex(const Vector3& point) const;
|
||||
|
||||
|
||||
[[nodiscard]]
|
||||
|
||||
@@ -13,7 +13,15 @@ namespace omath::prediction
|
||||
public:
|
||||
|
||||
[[nodiscard]]
|
||||
Vector3 PredictPosition(float time, float gravity) const;
|
||||
constexpr Vector3 PredictPosition(float time, float gravity) const
|
||||
{
|
||||
auto predicted = m_origin + m_velocity * time;
|
||||
|
||||
if (m_isAirborne)
|
||||
predicted.z -= gravity * std::pow(time, 2.f) * 0.5f;
|
||||
|
||||
return predicted;
|
||||
}
|
||||
|
||||
Vector3 m_origin;
|
||||
Vector3 m_velocity;
|
||||
|
||||
Reference in New Issue
Block a user