aswi2021virtual-surreality-gitlab/deltarobot-vr/Assets/DeltaRobotVr/ArrowScript.cs @ 996dd9cb
1 |
using UnityEngine; |
---|---|
2 |
|
3 |
namespace DeltaRobotVr |
4 |
{
|
5 |
public abstract class ArrowScript : MonoBehaviour |
6 |
{
|
7 |
public float lengthMultiplier = 2; |
8 |
void Start() |
9 |
{
|
10 |
}
|
11 |
|
12 |
void Update() |
13 |
{
|
14 |
if (Client.Instance.IsConnected) |
15 |
{
|
16 |
var vector = GetVector(); |
17 |
|
18 |
Vector3 v = Single3Utils.ToVector3(vector); |
19 |
this.transform.rotation = Quaternion.FromToRotation(Vector3.forward, v); |
20 |
this.transform.localScale = new Vector3(1, 1, v.magnitude * lengthMultiplier); |
21 |
}
|
22 |
}
|
23 |
|
24 |
protected abstract Single3 GetVector(); |
25 |
}
|
26 |
}
|