コード例 #1
0
ファイル: StateMirror.cs プロジェクト: ilya201232/Spake
 /// <summary>
 /// Copy an existing StateMirror.
 /// </summary>
 public StateMirror copyFromState(StateMirror state)
 {
     ownerTimestamp  = state.ownerTimestamp;
     position        = state.position;
     rotation        = state.rotation;
     scale           = state.scale;
     velocity        = state.velocity;
     angularVelocity = state.angularVelocity;
     return(this);
 }
コード例 #2
0
ファイル: StateMirror.cs プロジェクト: ilya201232/Spake
        /// <summary>
        /// Returns a Lerped StateMirror that is between two StateMirrors in time.
        /// </summary>
        /// <param name="start">Start StateMirror</param>
        /// <param name="end">End StateMirror</param>
        /// <param name="t">Time</param>
        /// <returns></returns>
        public static StateMirror Lerp(StateMirror targetTempStateMirror, StateMirror start, StateMirror end, float t)
        {
            targetTempStateMirror.position        = Vector3.Lerp(start.position, end.position, t);
            targetTempStateMirror.rotation        = Quaternion.Lerp(start.rotation, end.rotation, t);
            targetTempStateMirror.scale           = Vector3.Lerp(start.scale, end.scale, t);
            targetTempStateMirror.velocity        = Vector3.Lerp(start.velocity, end.velocity, t);
            targetTempStateMirror.angularVelocity = Vector3.Lerp(start.angularVelocity, end.angularVelocity, t);

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

            return(targetTempStateMirror);
        }
コード例 #3
0
 /// <summary>
 /// Copy an existing StateMirror.
 /// </summary>
 public StateMirror copyFromState(StateMirror 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);
 }