本文整理汇总了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);
}
}
示例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);
}