using GameCore.ECS; using GameCore.ECS.Interfaces; using GameCore.Input; namespace GameCore.Movement; public class RotationSystem : ISystem { private const float MinPitch = -(float)System.Math.PI / 2f; private const float MaxPitch = (float)System.Math.PI / 2f; public void Update(World world, float deltaTime) { var entities = world.GetEntitiesWith(); foreach (var entity in entities) { var input = world.GetComponent(entity); var rotation = world.GetComponent(entity); if (input == null || rotation == null) continue; rotation.Rotation.Y += input.LookDirection.Y; rotation.Rotation.X += input.LookDirection.X; rotation.Rotation.X = System.Math.Clamp(rotation.Rotation.X, MinPitch, MaxPitch); } } }