using System; using UnityEngine; namespace Tracking { public class FrontWheelTracker : CalibratableTracker { protected override string KeyPrefix => "fw"; public float trackerDistanceToWheelCenterPoint; public KineticLegTracker legTracker; public float SteerRotation { get { //legTracker position is added to compensate movements of the whole installation var posOnBikePlane = Vector3.ProjectOnPlane(RelativePosition + legTracker.RelativePosition, bicycleTransform.up); var theta = Mathf.Acos(Mathf.Clamp(posOnBikePlane.x / trackerDistanceToWheelCenterPoint, -1f, 1f)); return 90f - theta * Mathf.Rad2Deg; } } } }