save state
This commit is contained in:
20
Assets/PhoneInteraction.cs
Normal file
20
Assets/PhoneInteraction.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user