Tanoda
JSONPositioner.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using UnityEngine;
5
6public class JSONPositioner : MonoBehaviour
7{
8 [HideInInspector]public string Hash = "";
9 [HideInInspector]public Vector3 finalPos;
10 [HideInInspector]public Vector3 worldPos;
11 [HideInInspector]public Vector3 finalEulerAngle;
12
13 void Awake()
14 {
15 finalPos = transform.localPosition;
16 worldPos = transform.position;
17 finalEulerAngle = transform.localEulerAngles;
18 if (Hash == "")
19 Hash = HashingManager.instance.GetHash4GameObject(gameObject);
20 }
21
22 public void PassData(SceneNode json)
23 {
24 if (json == null) return;
25 try
26 {
27 transform.localRotation = json.transform.rotation;
28 transform.localPosition = json.localPos;
29
30 if (json.finalpos != default(Vector3))
31 {
32 var positioner = GetComponent<Positioner>();
33 if (positioner)
34 {
35 positioner.FinalPosition = json.finalpos;
36 positioner.FinalRotation = json.finalrot;
37 positioner.TolerancePos = json.tolp;
38 positioner.ToleranceRot = json.tolr;
39 }
40 }
41 }
42 catch (Exception)
43 {
44 // ignored
45 }
46 }
47
48}
void PassData(SceneNode json)
Vector3 finalEulerAngle
Vector3 finalPos
Quaternion rotation
Vector3 finalpos
JSONTransform transform
Vector3 finalrot
Vector3 localPos