Created
July 9, 2018 12:37
-
-
Save nopitech/408096ae0f5d8ca959d43ccce5270d69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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