added: simple scripts for object movement

This commit is contained in:
Chris
2025-08-02 17:08:57 -04:00
parent 07b7f5d48b
commit b3ff205e69
4 changed files with 49 additions and 0 deletions

20
Assets/SinMovement.cs Normal file
View File

@@ -0,0 +1,20 @@
using UnityEngine;
public class SinMovement : MonoBehaviour{
private float originalY;
public float speed;
public float scale;
public float offset;
void Start(){
originalY = transform.position.y;
offset += Random.Range(-1, 1);
}
// Update is called once per frame
void Update(){
transform.position = transform.position.Flatten(null, originalY + Mathf.Sin((Time.time + offset) * speed) * scale, null);
}
}