Skip to content

Instantly share code, notes, and snippets.

@nopitech
Created July 9, 2018 13:09
Show Gist options
  • Save nopitech/6f104e955611f9a8cf07b09a87057f2d to your computer and use it in GitHub Desktop.
Save nopitech/6f104e955611f9a8cf07b09a87057f2d to your computer and use it in GitHub Desktop.
using UnityEngine;
public class VectorScript : MonoBehaviour
{
void Update()
{
Vector3 from = Vector3.right * -5f; //現在地
Vector3 to = transform.position; //目的地
float smoothTime = Time.deltaTime * 0.1f; //移動スピード
Vector3 vel = Vector3.zero; //現在の速度
transform.position = Vector3.SmoothDamp(from, to, ref vel, smoothTime);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment