Tanoda
SimpleMatchAnchorScaleAndState.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
10using System.Collections;
11using System.Collections.Generic;
12using UnityEngine;
13
14namespace Leap.Unity.Examples {
15
16 [AddComponentMenu("")]
17 public class SimpleMatchAnchorScaleAndState : MonoBehaviour {
18
20
21 void Update() {
22 if (anchObj != null && anchObj.anchor != null && anchObj.isAttached) {
23 anchObj.transform.localScale = anchObj.anchor.transform.localScale;
24
25 anchObj.gameObject.SetActive(anchObj.anchor.gameObject.activeInHierarchy);
26
27 if (!anchObj.gameObject.activeInHierarchy) {
28 anchObj.transform.position = anchObj.anchor.transform.position;
29 if (anchObj.anchorRotation) anchObj.transform.rotation = anchObj.anchor.transform.rotation;
30 }
31 }
32 }
33
34 }
35
36}
AnchorableBehaviours mix well with InteractionBehaviours you'd like to be able to pick up and place i...