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