maint: moved sin and sway scripts to world folder

This commit is contained in:
Chris
2025-08-19 13:05:59 -04:00
parent 3f6cb7d3fb
commit 6184aa3e16
8 changed files with 385 additions and 0 deletions

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);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e33277577aa379a41a747f01aade9c96

View File

@@ -0,0 +1,25 @@
using UnityEngine;
public class SwayMovement : MonoBehaviour{
Vector3 originalRot;
public Vector3 swayAmount;
public Vector3 swaySpeed;
private Vector3 offset;
void Start(){
originalRot = transform.rotation.eulerAngles;
offset = new Vector3(Random.Range(-5, 1), Random.Range(-1, 5), Random.Range(-3, 1));
}
// Update is called once per frame
void Update(){
Vector3 sway = new Vector3(
originalRot.x + Mathf.Sin((Time.time + offset.x) * swaySpeed.x) * swayAmount.x,
originalRot.y + Mathf.Sin((Time.time + offset.y) * swaySpeed.y) * swayAmount.y,
originalRot.z + Mathf.Sin((Time.time + offset.z) * swaySpeed.z) * swayAmount.z
);
transform.rotation = Quaternion.Euler(sway);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 57870c7b66535c74688188df7e771ce7