System.Numerics.Vector3 GetHorizontalDirection(System.Numerics.Vector3 cameraForward)
{
return new SVector3(cameraForward.X, 0, cameraForward.Z);
}
float speed = 1f;
float x = 0f;
float z = 0f;
if (Keyboard.IsKeyDown(Key.W)) z = 1f;
if (Keyboard.IsKeyDown(Key.S)) z = -1f;
if (Keyboard.IsKeyDown(Key.A)) x = -1f;
if (Keyboard.IsKeyDown(Key.D)) x = 1f;
var move = GetHorizontalDirection(Player.CameraForward) * z + Player.CameraRight * x;
if (Keyboard.IsKeyDown(Key.Space) && IsGrounded())
{
if (Player.playerBody != null) Player.playerBody.LinearVelocity = new SVector3(move.X * speed, Player.JumpVelocity, move.Z * speed);
ThreadPool.QueueUserWorkItem(UpdateSoundEnginePlayerParams, null, false);
}
else if (Player.playerBody != null)
{
Player.playerBody.LinearVelocity = new SVector3(move.X * speed, Player.playerBody.LinearVelocity.Y, move.Z * speed);
ThreadPool.QueueUserWorkItem(UpdateSoundEnginePlayerParams, null, false);
}
System.Numerics.Vector3 GetHorizontalDirection(System.Numerics.Vector3 cameraForward)
{
return new SVector3(cameraForward.X, 0, cameraForward.Z);
}
float speed = 1f;
float x = 0f;
float z = 0f;
if (Keyboard.IsKeyDown(Key.W)) z = 1f;
if (Keyboard.IsKeyDown(Key.S)) z = -1f;
if (Keyboard.IsKeyDown(Key.A)) x = -1f;
if (Keyboard.IsKeyDown(Key.D)) x = 1f;
var move = GetHorizontalDirection(Player.CameraForward) * z + Player.CameraRight * x;
if (Keyboard.IsKeyDown(Key.Space) && IsGrounded())
{
if (Player.playerBody != null) Player.playerBody.LinearVelocity = new SVector3(move.X * speed, Player.JumpVelocity, move.Z * speed);
ThreadPool.QueueUserWorkItem(UpdateSoundEnginePlayerParams, null, false);
}
else if (Player.playerBody != null)
{
Player.playerBody.LinearVelocity = new SVector3(move.X * speed, Player.playerBody.LinearVelocity.Y, move.Z * speed);
ThreadPool.QueueUserWorkItem(UpdateSoundEnginePlayerParams, null, false);
}