Tanoda
FollowOtherHand.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5public class FollowOtherHand : MonoBehaviour
6{
7 public GameObject otherHandAttachPoint;
8 // Start is called before the first frame update
9 void Start()
10 {
11
12 }
13
14 // Update is called once per frame
15 void Update()
16 {
17 transform.LookAt(otherHandAttachPoint.transform.position, Vector3.ProjectOnPlane(otherHandAttachPoint.transform.right, -transform.forward));
18
19#if DANA
20 transform.localPosition = Vector3.zero;
21
22#else
23 var hand = GetComponentInParent<HackedHand>().gameObject;
24 var otherHand = otherHandAttachPoint.GetComponentInParent<HackedHand>().gameObject;
25 transform.position = new Vector3((hand.transform.position.x + otherHand.transform.position.x)/2 , (hand.transform.position.y + otherHand.transform.position.y)/2, (hand.transform.position.z + otherHand.transform.position.z)/2);
26 //if (transform.childCount > 0)
27 //{
28 // transform.GetChild(0).localPosition = Vector3.zero;
29 // transform.GetChild(0).localEulerAngles = Vector3.zero;
30 //}
31
32#endif
33 }
34}
GameObject otherHandAttachPoint