当前位置: 首页>>代码示例>>C#>>正文


C# VRage.ReadVector3方法代码示例

本文整理汇总了C#中VRage.ReadVector3方法的典型用法代码示例。如果您正苦于以下问题:C# VRage.ReadVector3方法的具体用法?C# VRage.ReadVector3怎么用?C# VRage.ReadVector3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VRage的用法示例。


在下文中一共展示了VRage.ReadVector3方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClientRead

        void ClientRead(VRage.Library.Collections.BitStream stream)
        {
            bool hasClientData= stream.ReadBool();
            uint? timeStamp = null;
            if (hasClientData)
            {
                timeStamp = stream.ReadUInt32();
                m_lastRecievedTimeStamp = timeStamp.Value;
        
                bool isUpdate = stream.ReadBool();
                if (isUpdate)
                {
                    MyTransformD serverTransform = new MyTransformD();
                    serverTransform.Position = stream.ReadVector3D();
                    serverTransform.Rotation = Quaternion.Identity;

                    CustomClientRead(timeStamp.Value, ref serverTransform, stream);
                }
            }

            Vector3 serverLinearVelocity = stream.ReadVector3();
            Vector3 serverAngularVelocity = stream.ReadVector3();

            MyTimeStampValues? clientData = null;
            if (timeStamp.HasValue)
            {
                clientData = m_timestamp.GetTransform(timeStamp.Value);
            }

            if (clientData.HasValue)
            {
                Vector3 linearDelta = serverLinearVelocity / MyEntityPhysicsStateGroup.EffectiveSimulationRatio - clientData.Value.LinearVelocity;
                Entity.Physics.LinearVelocity += Vector3.Round(linearDelta, 2);
                Vector3 angularDelta = serverAngularVelocity / MyEntityPhysicsStateGroup.EffectiveSimulationRatio - clientData.Value.AngularVelocity;
                Entity.Physics.AngularVelocity += Vector3.Round(angularDelta, 2);

                m_timestamp.UpdateDeltaVelocities(timeStamp.Value, ref linearDelta, ref angularDelta);
            }
            else
            {
                Vector3 linearVelocity = serverLinearVelocity / MyEntityPhysicsStateGroup.EffectiveSimulationRatio;
                Entity.Physics.LinearVelocity = Vector3.Round(linearVelocity, 2);
                Vector3 angularVelocity = serverAngularVelocity / MyEntityPhysicsStateGroup.EffectiveSimulationRatio;
                Entity.Physics.AngularVelocity = Vector3.Round(angularVelocity, 2);

            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:47,代码来源:MyEntityPositionVerificationStateGroup.cs

示例2: ClientRead

        void ClientRead(VRage.Library.Collections.BitStream stream)
        {    
            uint timeStamp = stream.ReadUInt32();
            if(m_lastRecievedTimeStamp > timeStamp)
            {
                return;
            }
            m_lastRecievedTimeStamp = timeStamp;

            MyTimeStampValues serverPositionAndOrientation = new MyTimeStampValues();
            serverPositionAndOrientation.Transform = new MyTransformD();
            serverPositionAndOrientation.Transform.Position = stream.ReadVector3D();
            serverPositionAndOrientation.Transform.Rotation = stream.ReadQuaternionNorm();
            serverPositionAndOrientation.LinearVelocity = stream.ReadVector3();
            serverPositionAndOrientation.AngularVelocity = stream.ReadVector3();

            serverPositionAndOrientation.LinearVelocity /= MyEntityPhysicsStateGroup.EffectiveSimulationRatio;
            serverPositionAndOrientation.AngularVelocity /= MyEntityPhysicsStateGroup.EffectiveSimulationRatio;
           
            CustomClientRead(timeStamp, ref serverPositionAndOrientation, stream);
        }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:21,代码来源:MyEntityPositionVerificationStateGroup.cs


注:本文中的VRage.ReadVector3方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。