コード例 #1
0
        /// <summary>
        /// The reported angular velocity on the first active <see cref="VelocityTracker"/>.
        /// </summary>
        /// <returns>The current angular velocity.</returns>
        protected override Vector3 DoGetAngularVelocity()
        {
            Vector3 currentAngularVelocity = Vector3.zero;

            cachedTracker = null;
            foreach (VelocityTracker currentTracker in velocityTrackers.EmptyIfNull())
            {
                if (currentTracker != null && currentTracker.IsActive())
                {
                    currentAngularVelocity = currentTracker.GetAngularVelocity();
                    cachedTracker          = currentTracker;
                    break;
                }
            }
            return(currentAngularVelocity);
        }
コード例 #2
0
 /// <summary>
 /// Clears the existing proxy source.
 /// </summary>
 public virtual void ClearProxySource()
 {
     proxySource           = null;
     cachedVelocityTracker = null;
 }
コード例 #3
0
 /// <summary>
 /// Sets the source of the <see cref="VelocityTracker"/> proxy.
 /// </summary>
 /// <param name="proxySource">The <see cref="Component"/> that contains a <see cref="VelocityTracker"/>.</param>
 public virtual void SetProxySource(Component proxySource)
 {
     this.proxySource      = proxySource;
     cachedVelocityTracker = (proxySource == null ? null : proxySource.GetComponentInChildren <VelocityTracker>());
 }