Skip to content

Commit 8933484

Browse files
pcvonzakien-mga
authored andcommitted
Fix observer yaw and pitch
1 parent f61c760 commit 8933484

File tree

3 files changed

+104
-75
lines changed

3 files changed

+104
-75
lines changed

misc/window_management/observer/observer.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ func _physics_process(delta):
3737
move_and_collide(dir * 10 * delta)
3838
var d = delta * 0.1
3939

40-
var yaw = get_transform().rotated(Vector3(0, 1, 0), d * r_pos.x)
41-
set_transform(yaw)
40+
# set yaw
41+
rotate(Vector3(0, 1, 0), d*r_pos.x)
4242

43+
# set pitch
4344
var pitch = $Camera.get_transform().rotated(Vector3(1, 0, 0), d * r_pos.y)
4445
$Camera.set_transform(pitch)
4546

@@ -48,7 +49,7 @@ func _physics_process(delta):
4849

4950
func _input(event):
5051
if (event is InputEventMouseMotion):
51-
r_pos = event.relative
52+
r_pos = -event.relative
5253

5354
if (event.is_action("ui_cancel") and event.is_pressed() and !event.is_echo()):
5455
if (state == STATE_GRAB):

misc/window_management/observer/observer.tscn

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,45 @@
22

33
[ext_resource path="res://observer/observer.gd" type="Script" id=1]
44

5-
[node name="Observer" type="KinematicBody"]
5+
[node name="Observer" type="KinematicBody" index="0"]
66

77
input_ray_pickable = true
88
input_capture_on_drag = false
99
collision_layer = 1
1010
collision_mask = 1
11+
axis_lock_linear_x = false
12+
axis_lock_linear_y = false
13+
axis_lock_linear_z = false
14+
axis_lock_angular_x = false
15+
axis_lock_angular_y = false
16+
axis_lock_angular_z = false
1117
collision/safe_margin = 0.001
1218
script = ExtResource( 1 )
1319

14-
[node name="Camera" type="Camera" parent="."]
20+
[node name="Camera" type="Camera" parent="." index="0"]
1521

16-
projection = 0
17-
fov = 60.0
18-
near = 0.1
19-
far = 1000.0
2022
keep_aspect = 1
21-
current = false
2223
cull_mask = 1048575
2324
environment = null
2425
h_offset = 0.0
2526
v_offset = 0.0
26-
doppler/tracking = 0
27+
doppler_tracking = 0
28+
projection = 0
29+
current = false
30+
fov = 60.0
31+
size = 1.0
32+
near = 0.1
33+
far = 1000.0
2734

28-
[node name="OmniLight" type="OmniLight" parent="."]
35+
[node name="OmniLight" type="OmniLight" parent="." index="1"]
2936

3037
layers = 1
3138
light_color = Color( 1, 1, 1, 1 )
3239
light_energy = 1.0
40+
light_indirect_energy = 1.0
3341
light_negative = false
3442
light_specular = 0.5
43+
light_bake_mode = 1
3544
light_cull_mask = -1
3645
shadow_enabled = false
3746
shadow_color = Color( 0, 0, 0, 1 )

0 commit comments

Comments
 (0)