Tanoda
SimpleAnchorFeedback.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
9
using
Leap
.
Unity
.
Interaction
;
10
using
System.Collections;
11
using
System.Collections.Generic;
12
using
UnityEngine
;
13
14
namespace
Leap.Unity.Examples
{
15
16
[RequireComponent(typeof(
Anchor
))]
17
[AddComponentMenu(
""
)]
18
public
class
SimpleAnchorFeedback
: MonoBehaviour {
19
20
public
Transform
scaleTarget
;
21
22
private
Anchor
_anchor;
23
24
private
Vector3 _initScaleVector;
25
private
float
_curScale = 1F;
26
27
void
Start() {
28
_anchor = GetComponent<Anchor>();
29
30
_initScaleVector =
scaleTarget
.transform.localScale;
31
}
32
33
void
Update() {
34
float
_targetScale = 1F;
35
36
if
(_anchor.
isPreferred
) {
37
_targetScale = 1.3F;
38
}
39
40
if
(_anchor.
hasAnchoredObjects
) {
41
_targetScale = 2.4F;
42
}
43
44
_curScale = Mathf.Lerp(_curScale, _targetScale, 20F * Time.deltaTime);
45
46
scaleTarget
.transform.localScale = _curScale * _initScaleVector;
47
}
48
49
}
50
51
}
Leap.Unity.Examples.SimpleAnchorFeedback
Definition:
SimpleAnchorFeedback.cs:18
Leap.Unity.Examples.SimpleAnchorFeedback.scaleTarget
Transform scaleTarget
Definition:
SimpleAnchorFeedback.cs:20
Leap.Unity.Interaction.Anchor
Definition:
Anchor.cs:19
Leap.Unity.Interaction.Anchor.hasAnchoredObjects
bool hasAnchoredObjects
Definition:
Anchor.cs:54
Leap.Unity.Interaction.Anchor.isPreferred
bool isPreferred
Definition:
Anchor.cs:52
Leap.Unity.Examples
Definition:
InertiaPostProcessProvider.cs:12
Leap.Unity.Interaction
Definition:
MovePoseExample.cs:11
Leap.Unity
Definition:
AssetFolderPropertyDrawer.cs:15
Leap
Definition:
AssetFolderPropertyDrawer.cs:15
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Plugins
LeapMotion
Modules
InteractionEngine
Examples
5. Anchors
SimpleAnchorFeedback.cs
Generated by
1.9.3