123456789101112131415161718192021222324252627282930 |
- using Blue;
- using UnityEngine;
- public class GetScenePosRot : AbstractController
- {
- public Transform meshTest;
- public Transform meshTestParent;
- private void Awake()
- {
- meshTestParent = GameObject.Find("ARSpaceForAll").transform;
- meshTest = GameObject.Find("ARSpaceForAll/mesh_test").gameObject.transform;
- this.SubscribeEvent<GetScenePosRotEvent>(GetScenePosRotSuccess).UnSubScribeWhenGameObjectDestroyed(gameObject);
- }
- private void GetScenePosRotSuccess(GetScenePosRotEvent e)
- {
- Vector3 pos = new Vector3(e.PosRot[0].x, e.PosRot[0].y, e.PosRot[0].z);
- Vector3 rot = new Vector3(e.PosRot[1].x, e.PosRot[1].y, e.PosRot[1].z);
- SetPosRot(pos,rot);
- }
- private void SetPosRot(Vector3 pos,Vector3 rot)
- {
- meshTest.transform.parent = meshTestParent;
- meshTest.transform.localPosition = pos;
- meshTest.transform.localEulerAngles = rot;
- }
- }
|