Skip to content

Instantly share code, notes, and snippets.

@nopitech
Created July 9, 2018 12:37
Show Gist options
  • Save nopitech/408096ae0f5d8ca959d43ccce5270d69 to your computer and use it in GitHub Desktop.
Save nopitech/408096ae0f5d8ca959d43ccce5270d69 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class VectorScript : MonoBehaviour
{
void Update()
{
Vector3 current = Vector3.right * -5; //現在地
Vector3 target = Vector3.right * 5; //目標値
float maxRadiansDelta = Time.time; //2点間におけるラジアンの差分の範囲内で設定する
float maxMagnitudeDelta = 0f; //1回で何度回転させるか。
transform.position = Vector3.RotateTowards(current, target, maxRadiansDelta, maxMagnitudeDelta);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment