Version: 5.4 (switch to 5.5b)
  • C#
  • JS

Script language

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


Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



public static function MoveTowardsAngle(current: float, target: float, maxDelta: float): float;
public static float MoveTowardsAngle(float current, float target, float maxDelta);



MoveTowards と同じです。ただし、360 度の回転の場合は、正しく補間されるよう注意してください。

変数 currenttarget は度で表されています。 最適化のために maxDelta の負の値はサポートされていません。そのため振動を引き起こす可能性があります。ターゲットから current を遠ざけるためには、その角度に 180 を加えます。

var target = 270.0;
var speed = 45.0;

function Update () { var angle : float = Mathf.MoveTowardsAngle (transform.eulerAngles.y, target, speed * Time.deltaTime); transform.eulerAngles = Vector3(0, angle, 0); }
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float target = 270.0F; public float speed = 45.0F; void Update() { float angle = Mathf.MoveTowardsAngle(transform.eulerAngles.y, target, speed * Time.deltaTime); transform.eulerAngles = new Vector3(0, angle, 0); } }