-
Notifications
You must be signed in to change notification settings - Fork 1
/
CameraContainer.cs
40 lines (37 loc) · 1.01 KB
/
CameraContainer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Godot;
using System;
public class CameraContainer : Spatial
{
public override void _Ready()
{
}
public override void _Process(float delta)
{
float factor = 5;
if (Input.IsActionPressed("ui_page_down"))
{
GetNode<Camera>("Camera").Translate(Vector3.Back * delta * factor);
}
if (Input.IsActionPressed("ui_page_up"))
{
GetNode<Camera>("Camera").Translate(Vector3.Forward * delta * factor);
}
if (Input.IsActionPressed("ui_left"))
{
RotateY(-factor * delta / 3);
}
if (Input.IsActionPressed("ui_right"))
{
RotateY(factor * delta / 3);
}
if (Input.IsActionPressed("ui_up"))
{
Translate(Vector3.Up * delta * factor);
}
if (Input.IsActionPressed("ui_down"))
{
Translate(Vector3.Down * delta * factor);
}
GetNode<Camera>("Camera").LookAt(Vector3.Up * 1, Vector3.Up);
}
}