本文整理汇总了C#中InputHelper.AddMouseRotation方法的典型用法代码示例。如果您正苦于以下问题:C# InputHelper.AddMouseRotation方法的具体用法?C# InputHelper.AddMouseRotation怎么用?C# InputHelper.AddMouseRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputHelper
的用法示例。
在下文中一共展示了InputHelper.AddMouseRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleInput
public override void HandleInput(InputHelper inputHelper)
{
base.HandleInput(inputHelper);
if (Target == null)
return;
switch (Mode)
{
case MovementMode.XYZ:
#region XYZ
Vector3 vectorToAdd = Vector3.Zero;
if (inputHelper.IsKeyDown(Keys.W))
vectorToAdd -= Vector3.UnitZ;
if (inputHelper.IsKeyDown(Keys.S))
vectorToAdd += Vector3.UnitZ;
if (inputHelper.IsKeyDown(Keys.D))
vectorToAdd += Vector3.UnitX;
if (inputHelper.IsKeyDown(Keys.A))
vectorToAdd -= Vector3.UnitX;
if (inputHelper.IsKeyDown(Keys.Q))
vectorToAdd -= Vector3.UnitY;
if (inputHelper.IsKeyDown(Keys.E))
vectorToAdd += Vector3.UnitY;
if (inputHelper.IsKeyDown(Keys.R))
position = Vector3.Zero;
if (inputHelper.IsKeyDown(Keys.D1))
Speed /= 1.25f;
if (inputHelper.IsKeyDown(Keys.D2))
Speed *= 1.25f;
inputHelper.AddMouseRotation(RotationSpeed * updateTime, ref rotation);
Matrix cameraRotation = Matrix.CreateRotationX(rotation.X) * Matrix.CreateRotationY(rotation.Y);
Vector3 rotatedVector = Vector3.Transform(vectorToAdd * Speed * updateTime, cameraRotation);
position += rotatedVector;
#endregion XYZ
break;
case MovementMode.XZ:
break;
default:
break;
}
}
示例2: HandleInput
public override void HandleInput(InputHelper inputHelper)
{
base.HandleInput(inputHelper);
if (obj == null)
{
Vector3 vectorToAdd = Vector3.Zero;
if (inputHelper.IsKeyDown(Keys.W))
vectorToAdd -= Vector3.UnitZ;
if (inputHelper.IsKeyDown(Keys.S))
vectorToAdd += Vector3.UnitZ;
if (inputHelper.IsKeyDown(Keys.D))
vectorToAdd += Vector3.UnitX;
if (inputHelper.IsKeyDown(Keys.A))
vectorToAdd -= Vector3.UnitX;
if (inputHelper.IsKeyDown(Keys.Q))
vectorToAdd -= Vector3.UnitY;
if (inputHelper.IsKeyDown(Keys.E))
vectorToAdd += Vector3.UnitY;
if (inputHelper.IsKeyDown(Keys.R))
position = Vector3.Zero;
if (inputHelper.IsKeyDown(Keys.D1))
walkSpeed /= 1.25f;
if (inputHelper.IsKeyDown(Keys.D2))
walkSpeed *= 1.25f;
inputHelper.AddMouseRotation(rotSpeed, ref rotation);
Matrix cameraRotation = Matrix.CreateRotationX(rotation.X) * Matrix.CreateRotationY(rotation.Y);
Vector3 rotatedVector = Vector3.Transform(vectorToAdd * walkSpeed, cameraRotation);
position += rotatedVector;
}
}