Legacy Documentation: Version 2017.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Quaternion.Slerp

public static Quaternion Slerp(Quaternion a, Quaternion b, float t);

Description

Spherically interpolates between a and b by t. The parameter t is clamped to the range [0, 1].

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Transform from; public Transform to; public float speed = 0.1F; void Update() { transform.rotation = Quaternion.Slerp(from.rotation, to.rotation, Time.time * speed); } }

See Also: Lerp, SlerpUnclamped.

Did you find this page useful? Please give it a rating: