mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
feat: sync entity direction and rotate models accordingly
Move direction into the transform component and include it in server-to-client entity updates. Client now sets transform direction from the network message and uses it to compute yaw for model rotation, so entities visually face their movement direction. Refactor net_utils to support arbitrary Vec3 fields.
This commit is contained in:
@@ -29,7 +29,7 @@ void WanderAISystem::do_ai(BaseServerCreature& creature,
|
||||
MoveBoost& move_boost) {
|
||||
thread_local Random r{std::random_device()()};
|
||||
if (r.random_bool(DIRECTION_PROBABILITY)) {
|
||||
creature.direction.value = r.random_direction_horizontal();
|
||||
creature.transform.direction.value = r.random_direction_horizontal();
|
||||
}
|
||||
if (r.random_bool(MOVE_PROBABILITY)) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user