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:
=
2026-04-24 17:35:31 +02:00
parent 08e3ce5899
commit 53361ba637
3 changed files with 14 additions and 20 deletions
+7 -8
View File
@@ -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);
}
}
}