void OnRotate(Vector2 rawRotation) { Vector2 rotation = Config.RotationSpeed * Time.deltaTime * rawRotation; Utils.clamp(ref rotation, -Config.MaxRotationSpeed, Config.MaxRotationSpeed); EntityTransform.Rotate(new Vector3(-rotation.y, 0, 0), Space.Self); EntityTransform.Rotate(new Vector3(0, rotation.x, 0), Space.World); }
public CaveInputProcessor(InputConfig config, CaveInputBinding binding, InputController controller) : base(config, binding, controller) { binding.MovementJoystick.OnXAxisMove += amount => EntityTransform.Rotate(0, amount * Config.RotationSpeed, 0); binding.MovementJoystick.OnYAxisMove += amount => EntityTransform.Translate(0, 0, amount * Config.MovementSpeed); binding.NodePointer.OnPointed += OnNodePointed; binding.NodeChooser.OnPointed += OnNodeChooserMoved; binding.ExitNodeTraverseMode.OnPress += ExitNodeTraverseMode; }
private void Rotate(float amount) { EntityTransform.Rotate(0, Mathf.Clamp(amount * Config.RotationSpeed, -Config.MaxRotationSpeed.x, Config.MaxRotationSpeed.x), 0, Space.World); }