Compare commits
4 commits
1cdd89ce5e
...
4e8b397948
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e8b397948 | |||
| c78368c89e | |||
| db0aa2ad9e | |||
| eac591cf29 |
6 changed files with 79 additions and 32 deletions
26
main.tscn
26
main.tscn
|
|
@ -3,10 +3,10 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://qb8cbljxgnub" path="res://world/killbrick.tscn" id="1_h2yge"]
|
[ext_resource type="PackedScene" uid="uid://qb8cbljxgnub" path="res://world/killbrick.tscn" id="1_h2yge"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cfceg80unq0pe" path="res://player/player.tscn" id="1_ig7tw"]
|
[ext_resource type="PackedScene" uid="uid://cfceg80unq0pe" path="res://player/player.tscn" id="1_ig7tw"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bcmrj6qkemrll" path="res://world/radiohead_cube.tscn" id="2_0xm2m"]
|
[ext_resource type="PackedScene" uid="uid://bcmrj6qkemrll" path="res://world/radiohead_cube.tscn" id="2_0xm2m"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b3wpwmlq750rc" path="res://world/textures/grass.jpg" id="2_272bh"]
|
[ext_resource type="Texture2D" uid="uid://wdjmyv260he1" path="res://world/textures/grass.jpg" id="2_272bh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://of6tq8gpjxtu" path="res://gears/gear_pickup.tscn" id="3_lquwl"]
|
[ext_resource type="PackedScene" uid="uid://of6tq8gpjxtu" path="res://gears/gear_pickup.tscn" id="3_lquwl"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bafl8q0r61xrg" path="res://gears/gear.tscn" id="4_7mycd"]
|
[ext_resource type="PackedScene" uid="uid://bafl8q0r61xrg" path="res://gears/gear.tscn" id="4_7mycd"]
|
||||||
[ext_resource type="Shader" uid="uid://cbufc0lxtpjco" path="res://world/shaders/sky.gdshader" id="7_272bh"]
|
[ext_resource type="Texture2D" uid="uid://2ku62tk8r74x" path="res://world/textures/sky.hdr" id="8_5vw27"]
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_7dm0k"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_7dm0k"]
|
||||||
size = Vector3(1000, 2, 1000)
|
size = Vector3(1000, 2, 1000)
|
||||||
|
|
@ -19,18 +19,21 @@ albedo_color = Color(0, 1, 0, 1)
|
||||||
albedo_texture = ExtResource("2_272bh")
|
albedo_texture = ExtResource("2_272bh")
|
||||||
uv1_scale = Vector3(300, 300, 300)
|
uv1_scale = Vector3(300, 300, 300)
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_272bh"]
|
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_272bh"]
|
||||||
shader = ExtResource("7_272bh")
|
panorama = ExtResource("8_5vw27")
|
||||||
shader_parameter/skyColor = Color(0.4991548, 0.59654385, 0.98058206, 1)
|
|
||||||
shader_parameter/horizonColor = Color(0.64705884, 0.6901961, 0.8509804, 1)
|
|
||||||
|
|
||||||
[sub_resource type="Sky" id="Sky_7mycd"]
|
[sub_resource type="Sky" id="Sky_7mycd"]
|
||||||
sky_material = SubResource("ShaderMaterial_272bh")
|
sky_material = SubResource("PanoramaSkyMaterial_272bh")
|
||||||
|
|
||||||
[sub_resource type="Environment" id="Environment_7mycd"]
|
[sub_resource type="Environment" id="Environment_7mycd"]
|
||||||
background_mode = 2
|
background_mode = 2
|
||||||
sky = SubResource("Sky_7mycd")
|
sky = SubResource("Sky_7mycd")
|
||||||
sky_rotation = Vector3(6.2831855, 0, 0)
|
sky_rotation = Vector3(6.2831855, 0, 0)
|
||||||
|
glow_enabled = true
|
||||||
|
glow_intensity = 0.1
|
||||||
|
glow_bloom = 0.02
|
||||||
|
glow_blend_mode = 0
|
||||||
|
glow_hdr_luminance_cap = 0.0
|
||||||
|
|
||||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_272bh"]
|
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_272bh"]
|
||||||
|
|
||||||
|
|
@ -49,10 +52,6 @@ shape = SubResource("BoxShape3D_7dm0k")
|
||||||
mesh = SubResource("BoxMesh_ig7tw")
|
mesh = SubResource("BoxMesh_ig7tw")
|
||||||
surface_material_override/0 = SubResource("StandardMaterial3D_272bh")
|
surface_material_override/0 = SubResource("StandardMaterial3D_272bh")
|
||||||
|
|
||||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
|
||||||
transform = Transform3D(0.7071068, -0.49999994, 0.49999994, 0, 0.7071067, 0.7071067, -0.7071068, -0.49999994, 0.49999994, 50, 50, 50)
|
|
||||||
shadow_enabled = true
|
|
||||||
|
|
||||||
[node name="radiohead cube" parent="." instance=ExtResource("2_0xm2m")]
|
[node name="radiohead cube" parent="." instance=ExtResource("2_0xm2m")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16, 3, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16, 3, 0)
|
||||||
|
|
||||||
|
|
@ -78,3 +77,8 @@ transform = Transform3D(1, 0, 0, 0, -0.012967386, 0.9999159, 0, -0.9999159, -0.0
|
||||||
environment = SubResource("Environment_7mycd")
|
environment = SubResource("Environment_7mycd")
|
||||||
camera_attributes = SubResource("CameraAttributesPractical_272bh")
|
camera_attributes = SubResource("CameraAttributesPractical_272bh")
|
||||||
compositor = SubResource("Compositor_5vw27")
|
compositor = SubResource("Compositor_5vw27")
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
transform = Transform3D(0.70710665, 0.5, -0.5, 0, 0.7071067, 0.7071067, 0.7071069, -0.49999988, 0.49999988, -500, 200, 500)
|
||||||
|
light_color = Color(1, 0.87058824, 0.12941177, 1)
|
||||||
|
shadow_enabled = true
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
class_name CameraGimbal extends Node3D
|
class_name CameraGimbal extends Node3D
|
||||||
|
|
||||||
@export var rotation_speed = (PI / 180) * 120
|
@export var rotation_speed = (PI / 180) * 120
|
||||||
|
@export var shift_lock = false
|
||||||
|
|
||||||
|
var locked_mouse_positon = Vector2(0,0)
|
||||||
|
var mouse_locked = false
|
||||||
|
var mouse_x_velocity = 0
|
||||||
|
var mouse_y_velocity = 0
|
||||||
|
var zoom_min = 0
|
||||||
|
var zoom_max = 100
|
||||||
|
var current_zoom = 0
|
||||||
|
|
||||||
func reset():
|
func reset():
|
||||||
basis = Basis()
|
basis = Basis()
|
||||||
|
|
@ -13,23 +22,47 @@ func rotate_camera_x(x, delta):
|
||||||
Vector3.RIGHT, x * rotation_speed * delta)
|
Vector3.RIGHT, x * rotation_speed * delta)
|
||||||
$InnerGimbal.rotation.x = clamp($InnerGimbal.rotation.x,-0.8,0.7)
|
$InnerGimbal.rotation.x = clamp($InnerGimbal.rotation.x,-0.8,0.7)
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
mouse_x_velocity = event.relative.x
|
||||||
|
mouse_y_velocity = event.relative.y
|
||||||
|
elif event.is_action_pressed("zoom_out"):
|
||||||
|
current_zoom += 5
|
||||||
|
elif event.is_action_pressed("zoom_in"):
|
||||||
|
current_zoom -= 5
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
# rotate outer gimbal around y axis
|
# rotate outer gimbal around y axis
|
||||||
var y = 0
|
var y = 0
|
||||||
if Input.is_action_pressed("cam_left"):
|
|
||||||
y += 1
|
|
||||||
if Input.is_action_pressed("cam_right"):
|
|
||||||
y -= 1
|
|
||||||
rotate_camera_y(y, delta)
|
|
||||||
|
|
||||||
# rotate inner gimbal around x axis
|
|
||||||
var x = 0
|
var x = 0
|
||||||
if Input.is_action_pressed("cam_up"):
|
|
||||||
x -= 1
|
if Input.is_action_just_pressed("shift_lock"):
|
||||||
if Input.is_action_pressed("cam_down"):
|
if shift_lock == true:
|
||||||
x += 1
|
shift_lock = false
|
||||||
|
else:
|
||||||
|
shift_lock = true
|
||||||
|
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_RIGHT) or shift_lock == true:
|
||||||
|
if mouse_locked == false:
|
||||||
|
mouse_locked = true
|
||||||
|
locked_mouse_positon = get_viewport().get_mouse_position()
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
|
|
||||||
|
if mouse_x_velocity > 5 or mouse_x_velocity < -5:
|
||||||
|
y -= clamp(mouse_x_velocity / 12.5, -10, 10)
|
||||||
|
if mouse_y_velocity > 5 or mouse_y_velocity < -5:
|
||||||
|
x -= clamp(mouse_y_velocity / 12.5, -10, 10)
|
||||||
|
else:
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
mouse_locked = false
|
||||||
|
mouse_x_velocity = 0
|
||||||
|
mouse_y_velocity = 0
|
||||||
|
|
||||||
|
rotate_camera_y(y, delta)
|
||||||
rotate_camera_x(x, delta)
|
rotate_camera_x(x, delta)
|
||||||
|
|
||||||
# reset gimbals
|
# reset gimbals
|
||||||
if Input.is_action_pressed("cam_reset"):
|
if Input.is_action_pressed("cam_reset"):
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
|
current_zoom = clamp(current_zoom,zoom_min,zoom_max)
|
||||||
|
$InnerGimbal/Camera3D.position = Vector3($InnerGimbal/Camera3D.position.x,current_zoom,current_zoom)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=8 format=4 uid="uid://cfceg80unq0pe"]
|
[gd_scene load_steps=8 format=4 uid="uid://cfceg80unq0pe"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://djeyfi7vm2vw0" path="res://player/player.gd" id="1_onrkg"]
|
[ext_resource type="Script" uid="uid://bfflnag3p4gen" path="res://player/player.gd" id="1_onrkg"]
|
||||||
[ext_resource type="Script" uid="uid://oi6sint7jkc6" path="res://player/camera_gimbal.gd" id="2_onrkg"]
|
[ext_resource type="Script" uid="uid://oi6sint7jkc6" path="res://player/camera_gimbal.gd" id="2_onrkg"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cfb0gbwm57hm4" path="res://models/player_0.png" id="3_hqtel"]
|
[ext_resource type="Texture2D" uid="uid://cfb0gbwm57hm4" path="res://models/player_0.png" id="3_hqtel"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,28 @@ backpack_3={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":51,"physical_keycode":0,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":51,"physical_keycode":0,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
shift_lock={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
zoom_in={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
zoom_out={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
3d_physics/layer_1="World"
|
3d_physics/layer_1="World"
|
||||||
3d_physics/layer_2="Player"
|
3d_physics/layer_2="Player"
|
||||||
3d_physics/layer_3="Object"
|
3d_physics/layer_3="Object"
|
||||||
|
|
||||||
|
[physics]
|
||||||
|
|
||||||
|
3d/physics_interpolation/scene_traversal="Legacy"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
shader_type sky;
|
|
||||||
uniform vec3 skyColor : source_color;
|
|
||||||
uniform vec3 horizonColor : source_color;
|
|
||||||
|
|
||||||
void sky() {
|
|
||||||
float col = clamp(EYEDIR.y / 0.05, 0.0, 1.0);
|
|
||||||
vec3 finalColor = mix(horizonColor,skyColor,col);
|
|
||||||
COLOR = finalColor;
|
|
||||||
}
|
|
||||||
BIN
world/textures/sky.hdr
Normal file
BIN
world/textures/sky.hdr
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue