Compare commits
4 Commits
99ee0a8cde
...
922e16b582
Author | SHA1 | Date |
---|---|---|
Cat Flynn | 922e16b582 | |
ktyl | ac68b669f0 | |
ktyl | 09addb408e | |
Cat Flynn | 89174351ca |
|
@ -14,4 +14,3 @@ transform = Transform( 0.515898, 0.606099, -0.605386, -0.393123, 0.795389, 0.461
|
||||||
transform = Transform( 0.856869, 0.3292, -0.396741, 0.0949996, 0.655565, 0.749139, 0.506706, -0.679604, 0.53046, -0.599122, 0, 0 )
|
transform = Transform( 0.856869, 0.3292, -0.396741, 0.0949996, 0.655565, 0.749139, 0.506706, -0.679604, 0.53046, -0.599122, 0, 0 )
|
||||||
SemiMajorAxis = 6.166
|
SemiMajorAxis = 6.166
|
||||||
Eccentricity = 0.239
|
Eccentricity = 0.239
|
||||||
_speed = 0.877
|
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
[node name="OrbitCamera" type="Spatial"]
|
[node name="OrbitCamera" type="Spatial"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
_zoomSensitivity = 50.0
|
|
||||||
_cameraPath = NodePath("Camera")
|
|
||||||
|
|
||||||
[node name="Camera" type="Camera" parent="."]
|
[node name="Camera" type="Camera" parent="."]
|
||||||
transform = Transform( 1, 0, 0, 0, 0.964146, 0.265371, 0, -0.265371, 0.964146, 0, 2.21115, 9.48434 )
|
transform = Transform( 1, 0, 0, 0, 0.964146, 0.265371, 0, -0.265371, 0.964146, 0, 2.21115, 9.48434 )
|
||||||
|
|
|
@ -4,25 +4,7 @@ using System;
|
||||||
public class OrbitCamera : Spatial
|
public class OrbitCamera : Spatial
|
||||||
{
|
{
|
||||||
[Export]
|
[Export]
|
||||||
private float _lookSensitivity = 200f;
|
private float _sensitivity = 200f;
|
||||||
|
|
||||||
[Export]
|
|
||||||
private float _zoomSensitivity = 10f;
|
|
||||||
|
|
||||||
[Export]
|
|
||||||
private NodePath _cameraPath;
|
|
||||||
private Camera _camera = null;
|
|
||||||
private Camera Camera
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_camera == null)
|
|
||||||
{
|
|
||||||
_camera = GetNode<Camera>(_cameraPath);
|
|
||||||
}
|
|
||||||
return _camera;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vector2 _rotation;
|
private Vector2 _rotation;
|
||||||
private bool _canRotate = false;
|
private bool _canRotate = false;
|
||||||
|
@ -42,8 +24,7 @@ public class OrbitCamera : Spatial
|
||||||
public override void _Process(float delta)
|
public override void _Process(float delta)
|
||||||
{
|
{
|
||||||
Rotation = Vector3.Zero;
|
Rotation = Vector3.Zero;
|
||||||
var sensitivity = -1f / _lookSensitivity;
|
var sensitivity = -1f / _sensitivity;
|
||||||
|
|
||||||
Rotate(Vector3.Right, _rotation.y * sensitivity);
|
Rotate(Vector3.Right, _rotation.y * sensitivity);
|
||||||
Rotate(Vector3.Up, _rotation.x * sensitivity);
|
Rotate(Vector3.Up, _rotation.x * sensitivity);
|
||||||
}
|
}
|
||||||
|
@ -51,23 +32,9 @@ public class OrbitCamera : Spatial
|
||||||
// left click to drag
|
// left click to drag
|
||||||
private void HandleMouseButton(InputEventMouseButton mouseButton)
|
private void HandleMouseButton(InputEventMouseButton mouseButton)
|
||||||
{
|
{
|
||||||
switch ((ButtonList)mouseButton.ButtonIndex)
|
if (mouseButton.ButtonIndex != (int)ButtonList.Left) return;
|
||||||
{
|
|
||||||
case ButtonList.Left:
|
|
||||||
_canRotate = mouseButton.Pressed;
|
|
||||||
break;
|
|
||||||
case ButtonList.WheelUp:
|
|
||||||
Zoom(-1);
|
|
||||||
break;
|
|
||||||
case ButtonList.WheelDown:
|
|
||||||
Zoom(1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Zoom(float amount)
|
_canRotate = mouseButton.Pressed;
|
||||||
{
|
|
||||||
Camera.Fov += amount * _zoomSensitivity / Camera.Fov;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleMouseMovement(InputEventMouseMotion mouseMotion)
|
private void HandleMouseMovement(InputEventMouseMotion mouseMotion)
|
||||||
|
|
|
@ -134,12 +134,9 @@ public class OrbitSystem : Node, IMassive, ILocation
|
||||||
|
|
||||||
private float _time = 0;
|
private float _time = 0;
|
||||||
|
|
||||||
[Export]
|
|
||||||
private float _speed = 3f;
|
|
||||||
|
|
||||||
public override void _Process(float delta)
|
public override void _Process(float delta)
|
||||||
{
|
{
|
||||||
_time += delta * _speed;
|
_time += delta * 3f;
|
||||||
InvalidateGeometry();
|
InvalidateGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue