Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
1.0 KiB

namespace VRTK
{
using UnityEngine;
public class SDK_ControllerSim : MonoBehaviour
{
[HideInInspector]
public bool selected;
protected VRTK_VelocityEstimator cachedVelocityEstimator;
protected float magnitude;
protected Vector3 axis;
public Vector3 GetVelocity()
{
SetCaches();
return cachedVelocityEstimator.GetVelocityEstimate();
}
public Vector3 GetAngularVelocity()
{
SetCaches();
return cachedVelocityEstimator.GetAngularVelocityEstimate();
}
protected virtual void OnEnable()
{
SetCaches();
}
protected virtual void SetCaches()
{
if (cachedVelocityEstimator == null)
{
cachedVelocityEstimator = (GetComponent<VRTK_VelocityEstimator>() != null ? GetComponent<VRTK_VelocityEstimator>() : gameObject.AddComponent<VRTK_VelocityEstimator>());
}
}
}
}