-
Notifications
You must be signed in to change notification settings - Fork 0
/
InnerGimbal.cs
44 lines (39 loc) · 1.21 KB
/
InnerGimbal.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
41
42
43
44
using Godot;
using System;
public class InnerGimbal : Spatial
{
// Declare member variables here. Examples:
// private int a = 2;
// private string b = "text";
bool drag = false;
[Export]
public float RotationSpeed { get; set; } = 0.7f;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
public override void _Input(InputEvent inputEvent){
if(inputEvent is InputEventMouseButton button){
if((ButtonList)button.ButtonIndex == ButtonList.Right){
if(drag != true){
drag = true;
}else{
drag = false;
}
//MouseCameraControl(inputEvent);
}
}
if(inputEvent is InputEventMouseMotion motion && drag){
//GlobalRotate(new Vector3(1,0,0), Mathf.Deg2Rad(motion.Relative.y*RotationSpeed));
RotateX(Mathf.Deg2Rad(motion.Relative.y*RotationSpeed));
var rot = RotationDegrees;
rot.x = Mathf.Clamp(rot.x, -80,80);
RotationDegrees = rot;
}
}
// // Called every frame. 'delta' is the elapsed time since the previous frame.
// public override void _Process(float delta)
// {
//
// }
}