示例#1
0
 /// <summary>
 /// Copy an existing State.
 /// </summary>
 public StatePUN2 copyFromState(StatePUN2 state)
 {
     ownerTimestamp  = state.ownerTimestamp;
     position        = state.position;
     rotation        = state.rotation;
     scale           = state.scale;
     velocity        = state.velocity;
     angularVelocity = state.angularVelocity;
     return(this);
 }
示例#2
0
        /// <summary>
        /// Returns a Lerped state that is between two States in time.
        /// </summary>
        /// <param name="start">Start State</param>
        /// <param name="end">End State</param>
        /// <param name="t">Time</param>
        /// <returns></returns>
        public static StatePUN2 Lerp(StatePUN2 targetTempState, StatePUN2 start, StatePUN2 end, float t)
        {
            targetTempState.position        = Vector3.Lerp(start.position, end.position, t);
            targetTempState.rotation        = Quaternion.Lerp(start.rotation, end.rotation, t);
            targetTempState.scale           = Vector3.Lerp(start.scale, end.scale, t);
            targetTempState.velocity        = Vector3.Lerp(start.velocity, end.velocity, t);
            targetTempState.angularVelocity = Vector3.Lerp(start.angularVelocity, end.angularVelocity, t);

            targetTempState.ownerTimestamp = Mathf.Lerp(start.ownerTimestamp, end.ownerTimestamp, t);

            return(targetTempState);
        }
示例#3
0
 /// <summary>
 /// Copy an existing State.
 /// </summary>
 public StatePUN2 copyFromState(StatePUN2 state)
 {
     ownerTimestamp          = state.ownerTimestamp;
     position                = state.position;
     rotation                = state.rotation;
     scale                   = state.scale;
     velocity                = state.velocity;
     angularVelocity         = state.angularVelocity;
     receivedTimestamp       = state.receivedTimestamp;
     localTimeResetIndicator = state.localTimeResetIndicator;
     return(this);
 }