Пример #1
0
        void IState.SetTransforms(NetworkTransform transform, UE.Transform simulate, UE.Transform render)
        {
            transform.SetTransformsInternal(simulate, render);

            if (Entity.AttachIsRunning && simulate)
            {
                NetAssert.Same(transform, this.Storage.Values[transform.PropertyIndex].Transform);

                this.Storage.Values[transform.PropertyIndex].Vector3        = simulate.position;
                this.Storage.Values[transform.PropertyIndex + 1].Quaternion = simulate.rotation;
            }
        }
Пример #2
0
        void IState.ForceTransform(NetworkTransform transform, UE.Vector3 position, UE.Quaternion rotation)
        {
            if (Entity.IsOwner)
            {
                return;
            }

            var it = this.Frames.GetIterator();

            while (it.Next())
            {
                it.val.Values[transform.PropertyIndex].Vector3        = position;
                it.val.Values[transform.PropertyIndex + 1].Quaternion = rotation;
            }
        }
Пример #3
0
        Vector3 CalculateVelocity(NetworkTransform nt, Vector3 position)
        {
            switch (Extrapolation.VelocityMode)
            {
            case ExtrapolationVelocityModes.CalculateFromPosition:
                return((GetPosition(nt.Simulate) - position) * Core.Config.framesPerSecond);

            case ExtrapolationVelocityModes.CopyFromRigidbody:
                return(nt.Simulate.GetComponent <Rigidbody>().velocity);

            case ExtrapolationVelocityModes.CopyFromRigidbody2D:
                return(nt.Simulate.GetComponent <Rigidbody2D>().velocity);

            case ExtrapolationVelocityModes.CopyFromCharacterController:
                return(nt.Simulate.GetComponent <CharacterController>().velocity);

            default:
                NetLog.Error("Unknown velocity extrapolation mode {0}", Extrapolation.VelocityMode);
                return((GetPosition(nt.Simulate) - position) * Core.Config.framesPerSecond);
            }
        }
Пример #4
0
 void IState.ForceTransform(NetworkTransform transform, UE.Vector3 position)
 {
     (this as IState).ForceTransform(transform, position, UE.Quaternion.identity);
 }
Пример #5
0
 void IState.SetTransforms(NetworkTransform transform, UE.Transform simulate)
 {
     (this as IState).SetTransforms(transform, simulate, null);
 }