internal void Move(GeneralCameraComponent camera, KeywordMovingComponent movment) { var down = movment.IsKeywordDown ? 1f : 0.5f; var speedCorrection = 16f * down; var rotateCorrection = 5f * down; Vector3 move = Vector3.Zero; switch (movment.Direction) { case KeywordMovingComponent.MovingDirection.MoveForward: //move = MoveForward(down); move = camera.LookDirection * speedCorrection; break; case KeywordMovingComponent.MovingDirection.MoveBackward: move = -camera.LookDirection * speedCorrection; break; case KeywordMovingComponent.MovingDirection.TurnLeft: var axis = camera.UpDirection; camera.LookDirection = camera.LookDirection .TransformedNormal(Matrix4x4.CreateFromAxisAngle(axis, rotateCorrection.ToRad())); break; case KeywordMovingComponent.MovingDirection.TurnRight: camera.LookDirection = camera.LookDirection .TransformedNormal(Matrix4x4.CreateFromAxisAngle(-camera.UpDirection, rotateCorrection.ToRad())); break; } camera.Position += move; }
public void Handle(KeywordMovingComponent component) { throw new NotImplementedException(); }
public void Handle(KeywordMovingComponent movment) { var handler = new KeywordMovingHandler(); handler.Move(camera, movment); }