Changed camera to be fixed scroll (No user scroll possible) and changed the angle of the camera. Also added a "sprint" to the camera to increase speed of movement
This commit is contained in:
+7
-8
@@ -20,21 +20,20 @@ public partial class Camera3d : Camera3D
|
||||
_mouseDelta = Vector2.Zero;
|
||||
|
||||
Vector3 direction = Vector3.Zero;
|
||||
if (Input.IsActionPressed("move_forward")&& Position.Z > 0) direction += Transform.Basis.Z;
|
||||
if (Input.IsActionPressed("move_backward")&& Position.Z < layerSize * 4) direction -= Transform.Basis.Z;
|
||||
if (Input.IsActionPressed("move_forward") && Position.Z > 0) direction += Transform.Basis.Z;
|
||||
if (Input.IsActionPressed("move_backward") && Position.Z < layerSize * 4) direction -= Transform.Basis.Z;
|
||||
if (Input.IsActionPressed("move_left") && Position.X > 0) direction -= Transform.Basis.X;
|
||||
if (Input.IsActionPressed("move_right") && Position.X < layerSize * 4) direction += Transform.Basis.X;
|
||||
|
||||
if (direction != Vector3.Zero)
|
||||
{
|
||||
direction = direction.Normalized() * (Speed + 3 * Mathf.Log(Position.Y) + 1) * d;
|
||||
direction = direction.Normalized() * Speed * (Input.IsActionPressed("sprint") ? 2.5f : 1) * d;
|
||||
Translate(direction);
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("zoom_in") && Position.Y > 10)
|
||||
Translate(Transform.Basis.Y * ScrollStrength);
|
||||
|
||||
if (Input.IsActionJustPressed("zoom_out") && Position.Y < 50)
|
||||
Translate(-Transform.Basis.Y * ScrollStrength);
|
||||
if (Position.Y != 10 - visibleLayer * 4)
|
||||
{
|
||||
Position = new Vector3(Position.X, 10 - visibleLayer * 4, Position.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user