Cinemachine
First-Person Controller
public class FirstPersonController : MonoBehaviour
{
..
/// <summary>
/// Add input (affecting Yaw).
/// This is applied to the Character's rotation.
/// </summary>
public void AddControlYawInput(float value)
{
_character.AddYawInput(value);
}
/// <summary>
/// Add input (affecting Pitch).
/// This is applied to the cameraTarget's local rotation.
/// </summary>
public void AddControlPitchInput(float value, float minValue = -80.0f, float maxValue = 80.0f)
{
if (value == 0.0f)
return;
_cameraTargetPitch = MathLib.ClampAngle(_cameraTargetPitch + value, minValue, maxValue);
cameraTarget.transform.localRotation = Quaternion.Euler(-_cameraTargetPitch, 0.0f, 0.0f);
}
}Third-Person Controller
Last updated