private void Jump() { var jump = Vector3.up * JumpStrength + _direction.GetDirection() * Speed; _body.AddForce(jump.x, jump.y, jump.z, ForceMode.Impulse); _lastJump = Time.time; if (BounceSound != null) { if (_bounceSource == null) { _bounceSource = gameObject.AddComponent <AudioSource>(); _bounceSource.clip = BounceSound; _bounceSource.volume = BounceVolume; } _bounceSource.pitch = Random.Range(BounceMinPitch, BounceMaxPitch); _bounceSource.Play(); } }
private void SpinHead() { _head.rotation = Quaternion.LookRotation(_direction.GetDirection()) * Quaternion.Inverse(_body.rotation); // Debug.Log(" Head: " + _head.rotation + " from " + _direction.GetDirection() + " and " + _body.rotation); }