17 lines
517 B
C#
17 lines
517 B
C#
using UnityEngine;
|
|
|
|
public class Title : MonoBehaviour
|
|
{
|
|
[Header("Pengaturan Goyang")]
|
|
public float angle = 5f; // Seberapa miring? (5 derajat udah cukup)
|
|
public float speed = 3f; // Seberapa cepat goyangnya?
|
|
|
|
void Update()
|
|
{
|
|
// Rumus Sinus buat dapetin nilai -1 sampai 1 berulang-ulang
|
|
float zRotation = Mathf.Sin(Time.time * speed) * angle;
|
|
|
|
// Terapkan ke rotasi Z (karena 2D muternya di sumbu Z)
|
|
transform.rotation = Quaternion.Euler(0, 0, zRotation);
|
|
}
|
|
} |