summaryrefslogtreecommitdiff
path: root/InfoBubble.cs
blob: 3c410c3572ed478b326859a380c875de1f508a84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using UnityEngine;

public class InfoBubble : MonoBehaviour
{
	public Vector3 WobbleAxis = Vector3.one;

	public float WobbleFrequency = 1f;

	public float WobbleAmplitude = 0.25f;

	public Transform TrackTarget;

	private Vector3 startOffsetTarget;

	private void Start()
	{
		startOffsetTarget = base.transform.position - TrackTarget.position;
	}

	private void Update()
	{
		Vector3 eulerAngles = Mathf.Sin(WobbleFrequency * Time.timeSinceLevelLoad) * WobbleAxis * WobbleAmplitude;
		base.transform.Rotate(eulerAngles);
		base.transform.position = TrackTarget.position + startOffsetTarget;
	}
}