Files
MosisVR/Assets/PhoneInteraction.cs
2026-01-16 23:11:08 +01:00

21 lines
701 B
C#

using UnityEngine;
public class PhoneInteraction : MonoBehaviour
{
public GameObject Controller;
public GameObject Plane;
void Update()
{
var t = Controller.GetComponent<Transform>();
if (Physics.Raycast(t.position, t.forward, out RaycastHit hit) && hit.collider == Plane.GetComponent<Collider>())
{
var local = Plane.transform.InverseTransformPoint(hit.point);
var normalized = new Vector2((local.x + 5) / 10, (local.z + 5) / 10);
KotlinBridge.SendTouchMove(normalized.x, 1 - normalized.y);
//Debug.Log("MOVE " + normalized);
//Debug.DrawLine(t.position, hit.point, Color.green);
}
}
}