本文整理汇总了C#中Quaternion.RotateYawPitchRoll方法的典型用法代码示例。如果您正苦于以下问题:C# Quaternion.RotateYawPitchRoll方法的具体用法?C# Quaternion.RotateYawPitchRoll怎么用?C# Quaternion.RotateYawPitchRoll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quaternion
的用法示例。
在下文中一共展示了Quaternion.RotateYawPitchRoll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTransform
internal void SetTransform(float baseW, float baseH, float x, float y, float w, float h, float r)
{
//rotation
Quaternion RotateVector = new Quaternion();
RotateVector.RotateYawPitchRoll(0, 0, r);
//scaling
Vector3 ScaleVector = new Vector3(w / baseW, h / baseH, 1.0f);
Vector3 TranslateVector = Vector3.Empty;
if (ScaleVector.X != 1 || ScaleVector.Y != 1)
TranslateVector = new Vector3((float)(Camera.X * (ScaleVector.X - 1)), (float)(Camera.Y * (1 - ScaleVector.Y)), 0);
this.SpriteBatch.Transform = Matrix.Transformation(
new Vector3(x, y, 0), //scales from top left
Quaternion.Identity,
ScaleVector,
new Vector3(x + w / 2, y + h / 2, 0.0f), //rotates from center
RotateVector,
TranslateVector);
}