Files
ms-narrative-assignment-4-u…/assignment-four/Assets/Scripts/SinWave.cs
2025-10-21 13:31:04 +01:00

21 lines
543 B
C#

using UnityEngine;
public class SinWave : MonoBehaviour
{
public float sinMultiplier = 1f;
public float sinSpeed = 1f;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 currentLocation = gameObject.transform.position;
currentLocation.y += Mathf.Sin(Time.deltaTime * sinSpeed) * sinMultiplier;
gameObject.transform.position = currentLocation;
}
}