21 lines
701 B
C#
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);
|
|
}
|
|
}
|
|
}
|