namespace Zinnia.Tracking.Velocity
{
using UnityEngine;
///
/// Provides the velocity as set on its properties.
///
public class ConstantVelocityTracker : VelocityTracker
{
[Tooltip("The velocity to return.")]
[SerializeField]
private Vector3 velocity;
///
/// The velocity to return.
///
public Vector3 Velocity
{
get
{
return velocity;
}
set
{
velocity = value;
}
}
[Tooltip("The angular velocity to return.")]
[SerializeField]
private Vector3 angularVelocity;
///
/// The angular velocity to return.
///
public Vector3 AngularVelocity
{
get
{
return angularVelocity;
}
set
{
angularVelocity = value;
}
}
[Tooltip("Determines whether to extract the local property or the world property.")]
[SerializeField]
private bool useLocal;
///
/// Determines whether to extract the local property or the world property.
///
public bool UseLocal
{
get
{
return useLocal;
}
set
{
useLocal = value;
}
}
///
protected override Vector3 DoGetAngularVelocity()
{
return UseLocal ? transform.rotation * AngularVelocity : AngularVelocity;
}
///
protected override Vector3 DoGetVelocity()
{
return UseLocal ? transform.rotation * Velocity : Velocity;
}
}
}