Advertisement
LeeMace

wave up and down

Apr 19th, 2024
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.29 KB | Gaming | 0 0
  1. public class Wave : MonoBehaviour
  2. {
  3.     public float amplitude = 1f;
  4.     public float frequency = 1f;
  5.  
  6.     void Update() {
  7.         float y = Mathf.Sin(Time.time * frequency) * amplitude +5;
  8.         transform.position = new Vector3(transform.position.x, y, transform.position.z);
  9.     }
  10. }
Tags: wave
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement