mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
feat(creatures): refine pig movement physics
Add movement constants for pigs and switch deceleration to per-axis friction so creatures stop naturally. Extend wander boost duration for smoother behavior.
This commit is contained in:
@@ -3,4 +3,11 @@
|
||||
namespace Cubed {
|
||||
struct PigTag {};
|
||||
|
||||
namespace PigDefaults {
|
||||
constexpr float MAX_SPEED = 0.1f; // tiles/tick → 2 tiles/sec
|
||||
constexpr float ACCELERATION = 0.01f; // ~10 ticks (0.5s) to reach full speed
|
||||
constexpr float DECELERATION = 0.02f; // ~5 ticks (0.25s) to stop
|
||||
constexpr float GRAVITY = 1.0f; // ≈20 tiles/s², close to the player
|
||||
} // namespace PigDefaults
|
||||
|
||||
} // namespace Cubed
|
||||
@@ -1,14 +1,12 @@
|
||||
#pragma once
|
||||
#include "Cubed/gameplay/ecs/movement.hpp"
|
||||
#include "Cubed/gameplay/ecs/transform.hpp"
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
namespace Cubed {
|
||||
class ServerWorld;
|
||||
class PhysicalSystem {
|
||||
public:
|
||||
static glm::vec3 get_move_distance(const Direction& d,
|
||||
const TickVelocity& v);
|
||||
static glm::vec3 get_move_distance(const TickVelocity& v);
|
||||
|
||||
static void update(ServerWorld& world, entt::registry& registry);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user