add virtual phone

This commit is contained in:
2026-01-03 17:26:08 +01:00
parent 655c38ef45
commit f38cfaf677
12 changed files with 246 additions and 246 deletions

19
Assets/PhoneRotator.cs Normal file
View File

@@ -0,0 +1,19 @@
using Unity.Mathematics;
using UnityEngine;
public class PhoneRotator : MonoBehaviour
{
Quaternion initialRotation;
public float swingRange = 30f; // In Degrees
public float speed = 2f;
void Start()
{
initialRotation = GetComponent<Transform>().localRotation;
}
void Update()
{
float currentDegrees = Mathf.Sin(Time.time * speed) * swingRange;
Quaternion swingRotation = Quaternion.Euler(0, 0, currentDegrees);
GetComponent<Transform>().localRotation = initialRotation * swingRotation;
}
}