21 lines
473 B
C#
21 lines
473 B
C#
using UnityEngine;
|
|
|
|
public class Treesway : MonoBehaviour
|
|
{
|
|
[Header("Pengaturan Goyang")]
|
|
public float miringMaksimal = 3.0f;
|
|
public float kecepatanAngin = 1.5f;
|
|
|
|
private float offsetAcak;
|
|
|
|
void Start()
|
|
{
|
|
offsetAcak = Random.Range(0f, 100f);
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
float rotasiZ = Mathf.Sin((Time.time + offsetAcak) * kecepatanAngin) * miringMaksimal;
|
|
transform.rotation = Quaternion.Euler(0, 0, rotasiZ);
|
|
}
|
|
} |