Files
pgs/Assets/Scripts/IconFloatController.cs

21 lines
607 B
C#
Raw Normal View History

2026-02-21 16:58:22 -08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IconFloatController : MonoBehaviour {
[SerializeField] public float floatStrength = 4.0f;
[SerializeField] public float floatSpeed = 1.0f;
public Vector3 originalPosition;
// Start is called before the first frame update
void Start() {
originalPosition = transform.localPosition;
}
void FixedUpdate()
{
transform.localPosition = new Vector3(transform.localPosition.x,
originalPosition.y + Mathf.Sin(Time.time * floatSpeed) * floatStrength);
}
}