Tanoda
MovePoseExample.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using UnityEngine;
10
12
13 public class MovePoseExample : MonoBehaviour {
14
15 public Transform target;
16 private Pose _selfToTargetPose = Pose.identity;
17
18 private void OnEnable() {
19 _selfToTargetPose = this.transform.ToPose().inverse * target.transform.ToPose();
20 }
21
22 private void Start() {
23#if UNITY_2017_2_OR_NEWER
24 if (Physics.autoSyncTransforms) {
25 Debug.LogWarning(
26 "Physics.autoSyncTransforms is enabled. This will cause Interaction "
27 + "Buttons and similar elements to 'wobble' when this script is used to "
28 + "move a parent transform. You can modify this setting in "
29 + "Edit->Project Settings->Physics.");
30 }
31#endif
32 }
33
34 private void Update() {
35 target.transform.SetPose(this.transform.ToPose() * _selfToTargetPose);
36 }
37
38 }
39
40}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
A position and rotation. You can multiply two poses; this acts like Matrix4x4 multiplication,...
Definition: Pose.cs:21
Pose inverse
Definition: Pose.cs:37
static readonly Pose identity
Definition: Pose.cs:35