本文整理汇总了C#中Quaternion.GetBytes方法的典型用法代码示例。如果您正苦于以下问题:C# Quaternion.GetBytes方法的具体用法?C# Quaternion.GetBytes怎么用?C# Quaternion.GetBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quaternion
的用法示例。
在下文中一共展示了Quaternion.GetBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildObjectData
public static byte[] BuildObjectData(Vector3 position, Quaternion rotation, Vector3 velocity,
Vector3 acceleration, Vector3 angularVelocity)
{
byte[] objectData = new byte[60];
int pos = 0;
position.GetBytes().CopyTo(objectData, pos);
pos += 12;
velocity.GetBytes().CopyTo(objectData, pos);
pos += 12;
acceleration.GetBytes().CopyTo(objectData, pos);
pos += 12;
rotation.GetBytes().CopyTo(objectData, pos);
pos += 12;
angularVelocity.GetBytes().CopyTo(objectData, pos);
return objectData;
}
示例2: SetRotation
/// <summary>
/// Change the Rotation of an object that is either a child or a whole linkset
/// </summary>
/// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param>
/// <param name="localID">The objects ID which is local to the simulator the object is in</param>
/// <param name="quat">The new scale of the object</param>
/// <param name="childOnly">If true, will change rotation of this prim only, not entire linkset</param>
public void SetRotation(Simulator simulator, uint localID, Quaternion quat, bool childOnly)
{
UpdateType type = UpdateType.Rotation;
if (!childOnly)
type |= UpdateType.Linked;
MultipleObjectUpdatePacket multiObjectUpdate = new MultipleObjectUpdatePacket();
multiObjectUpdate.AgentData.AgentID = Client.Self.AgentID;
multiObjectUpdate.AgentData.SessionID = Client.Self.SessionID;
multiObjectUpdate.ObjectData = new MultipleObjectUpdatePacket.ObjectDataBlock[1];
multiObjectUpdate.ObjectData[0] = new MultipleObjectUpdatePacket.ObjectDataBlock();
multiObjectUpdate.ObjectData[0].Type = (byte)type;
multiObjectUpdate.ObjectData[0].ObjectLocalID = localID;
multiObjectUpdate.ObjectData[0].Data = quat.GetBytes();
Client.Network.SendPacket(multiObjectUpdate, simulator);
}