private void WatchOnMouse() { Vector3 mousePos = Input.mousePosition; Vector3 direction = Camera.main.ScreenToWorldPoint(mousePos) - transform.position; Quaternion needRot = InDirectionRotator.Rotate(direction); Tower.rotation = StraightQuaternionSwitcher.Get(Tower.rotation, needRot, TowerRotationSpeed * Time.fixedDeltaTime); }
private void Accelerate(out Vector2 newVelocity) { Vector2 shouldVel = transform.up * Speed; newVelocity = AccelerationCalculator.Vector(Rigidbody.velocity, shouldVel, Accel); Quaternion needRot = InDirectionRotator.Rotate(CurrentDirection); transform.rotation = StraightQuaternionSwitcher.Get(transform.rotation, needRot, BodyRotateSpeed * Time.fixedDeltaTime); IsAccelerating = false; IsDiagonalMove = false; }
public void SetRotation(Vector2 direction) { transform.rotation = InDirectionRotator.Rotate(direction); }