Revize 84cf5509
Přidáno uživatelem Jakub Hejman před téměř 4 roky(ů)
deltarobot-vr/Assets/DeltaRobotVr/Components/AbstractArrow.cs | ||
---|---|---|
8 | 8 |
public abstract class AbstractArrow : MonoBehaviour |
9 | 9 |
{ |
10 | 10 |
public float lengthMultiplier = 2; |
11 |
protected Renderer objectRenderer; |
|
12 |
|
|
13 |
private void Start() |
|
14 |
{ |
|
15 |
objectRenderer = GetComponent<Renderer>(); |
|
16 |
} |
|
11 | 17 |
|
12 | 18 |
void Update() |
13 | 19 |
{ |
... | ... | |
16 | 22 |
Vector3 v = Single3Utils.ToVector3(GetVector()); |
17 | 23 |
|
18 | 24 |
var t = transform; |
25 |
var zs = v.magnitude * lengthMultiplier; |
|
19 | 26 |
t.rotation = Quaternion.FromToRotation(Vector3.forward, v); |
20 |
t.localScale = new Vector3(1, 1, v.magnitude * lengthMultiplier); |
|
27 |
t.localScale = new Vector3(1, 1, zs); |
|
28 |
|
|
29 |
// If scale is 0, hide arrow |
|
30 |
// Seems fine without delta |
|
31 |
if (objectRenderer.enabled == (zs == 0.0f)) |
|
32 |
{ |
|
33 |
objectRenderer.enabled = !(zs == 0.0f); |
|
34 |
} |
|
21 | 35 |
} |
22 | 36 |
} |
23 | 37 |
|
Také k dispozici: Unified diff
Re #9003 - Updated default config based on testing in lab + various improvements