21 lines
511 B
C#
21 lines
511 B
C#
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;
|
|
}
|
|
}
|