21 lines
511 B
C#
Raw Normal View History

2025-09-06 17:17:39 +04:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpinAndBob : MonoBehaviour
{
[SerializeField] private float speed = 25f;
private float amplitude = 0.1f;
// Update is called once per frame
void Update()
{
transform.RotateAround(transform.position, transform.up, Time.deltaTime * speed);
Vector3 pos = transform.localPosition;
pos.y = Mathf.Sin(Time.time * 2f) * amplitude;
transform.localPosition = pos;
}
}