Created
February 13, 2020 19:32
-
-
Save kleberandrade/35b7cc2296b8a149a31e4b24117cdd59 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 PingPongUI : MonoBehaviour | |
{ | |
public float m_Range = 0.05f; | |
public float m_SmoothTime = 10.0f; | |
public Vector3 m_Axis = Vector3.up; | |
private Vector3 m_StartPosition; | |
private void Start() | |
{ | |
m_StartPosition = transform.position; | |
} | |
private void Update() | |
{ | |
transform.position = m_StartPosition + m_Axis * Mathf.Sin(Time.time * m_SmoothTime) * m_Range; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment