This commit is contained in:
Amazed 2020-04-15 13:45:56 +02:00
commit bcdd439d12
49 changed files with 7257 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# Imported translations (automatically generated from CSV files)
*.translation
# Mono-specific ignores
.mono/
data_*/

42
3d.gd Normal file
View File

@ -0,0 +1,42 @@
extends Spatial
#-----------------SCENE--SCRIPT------------------#
# Close your game faster by clicking 'Esc' #
# Change mouse mode by clicking 'Shift + F1' #
#------------------------------------------------#
export var fast_close := true
var mouse_mode: String = "CAPTURED"
onready var camera = get_node("Player/Head/Camera")
##################################################
func _ready() -> void:
if fast_close:
print("** Fast Close enabled in the 's_main.gd' script **")
print("** 'Esc' to close 'Shift + F1' to release mouse **")
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel") and fast_close:
get_tree().quit() # Quits the game
if event.is_action_pressed("mouse_input") and fast_close:
match mouse_mode: # Switch statement in GDScript
"CAPTURED":
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
mouse_mode = "VISIBLE"
"VISIBLE":
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
mouse_mode = "CAPTURED"
func _process(delta):
var pos = camera.get_global_transform().origin
get_node("Label").text = "X: "+str(pos.x)+", Y: "+str(pos.y)+", Z: "+str(pos.z)
var rotation = camera.rotation
get_node("Label").text += " X: "+str(rotation.x)+", Y: "+str(rotation.y)+", Z: "+str(rotation.z)
func _on_Button_pressed():
get_tree().quit()

56
3d.tscn Normal file
View File

@ -0,0 +1,56 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://player/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://MeshInstance.tscn" type="PackedScene" id=2]
[ext_resource path="res://3d.gd" type="Script" id=3]
[ext_resource path="res://ImmediateGeometry.gd" type="Script" id=4]
[ext_resource path="res://Water.tscn" type="PackedScene" id=5]
[sub_resource type="SpatialMaterial" id=7]
vertex_color_use_as_albedo = true
params_cull_mode = 2
[sub_resource type="SpatialMaterial" id=6]
vertex_color_use_as_albedo = true
params_diffuse_mode = 4
params_specular_mode = 4
params_cull_mode = 2
[node name="Spatial" type="Spatial"]
script = ExtResource( 3 )
[node name="Player" parent="." instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.151, 200, -0.003 )
[node name="GiantsTerrain" parent="." instance=ExtResource( 2 )]
material_override = SubResource( 7 )
[node name="Label" type="Label" parent="."]
margin_right = 40.0
margin_bottom = 14.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 1, 0, 0, 0, -0.00790628, 0.999969, 0, -0.999969, -0.00790628, 0, 300, 0 )
light_energy = 1.94
shadow_enabled = true
[node name="ImmediateGeometry" type="ImmediateGeometry" parent="."]
material_override = SubResource( 6 )
cast_shadow = 0
script = ExtResource( 4 )
[node name="Water" parent="." instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -10, 0 )
[node name="Button" type="Button" parent="."]
margin_top = 579.365
margin_right = 40.0
margin_bottom = 599.365
text = "Quit"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]

149
ImmediateGeometry.gd Normal file
View File

@ -0,0 +1,149 @@
extends ImmediateGeometry
var signature
var u0
var xoffset
var yoffset
var minheight
var maxheight
var xverticesnumber
var yverticesnumber
var stretch
var u1
var u2
var u3
var u4
var version
var u6
var u7
var u8
var tex
var edges
var file = File.new()
var vertices = []
var triangles = []
func _ready():
return
clear()
readgti("res://default.gti")
# triangles = [[-1, 0, -1, 0, 1, 255, 251], [-1,0,1, 0, 224, 255, 0], [1,0,-1, 0, 1, 0, 0]]
print("vertices: "+str(len(vertices)))
print("draw "+str(len(triangles)))
assert(len(triangles) % 3 == 0)
begin(Mesh.PRIMITIVE_TRIANGLES)
for i in range(len(triangles)):
var vertex = triangles[i]
if not vertex:
print(i)
else:
print("color: ("+str(vertex[6] / 255.0)+")")
set_color(Color(vertex[4] / 255.0, vertex[5] / 255.0, vertex[6] / 255.0))
add_vertex(Vector3(vertex[0], vertex[2], vertex[1]))
end()
func fill():
print("version="+str(version))
# fill read values
print("fill")
var p = 0
while p < xverticesnumber * yverticesnumber:
var b = file.get_8()
if b >= 0x80:
while b != 0x00:
if p >= xverticesnumber * yverticesnumber:
return
b = (b + 1) & 0xFF
p+=1
else:
while b != 0xff:
if p >= xverticesnumber * yverticesnumber:
return
if version != 7:
vertices[p][2] = file.get_float() # height
vertices[p][3] = file.get_8() # triangulation
vertices[p][4] = file.get_8() # R
vertices[p][5] = file.get_8() # G
vertices[p][6] = file.get_8() # B
else:
vertices[p][2] = file.get_float() # height
vertices[p][3] = file.get_8() # triangulation
vertices[p][4] = file.get_8() # R
vertices[p][5] = file.get_8() # G
vertices[p][6] = file.get_8() # B
var unk = file.get_8() # unk
# print("["+ str(vertices[p][0]) + ", "+ str(vertices[p][1])+", "+ str(vertices[p][2])+", "+ str(vertices[p][3])+", "+ str(vertices[p][4])+", "+ str(vertices[p][5])+", "+ str(vertices[p][6])+", "+str(b)+"]")
p+=1
b = (b - 1) & 0xFF
func readgti(filename):
file.open(filename, File.READ)
if not file.is_open():
get_tree().quit()
return
signature = file.get_32()
u0 = file.get_32()
xoffset = file.get_float()
yoffset = file.get_float()
minheight = file.get_float()
maxheight = file.get_float()
xverticesnumber = file.get_32()
yverticesnumber = file.get_32()
stretch = file.get_float()
u1 = file.get_float()
u2 = file.get_float()
u3 = file.get_float()
u4 = file.get_float()
version = file.get_16()
u6 = file.get_16()
u7 = file.get_float()
u8 = file.get_float()
tex = file.get_buffer(32).get_string_from_ascii()
vertices.resize(xverticesnumber * yverticesnumber)
# initialize empty terrain
print("init")
for y in range(yverticesnumber):
for x in range(xverticesnumber):
vertices[y * xverticesnumber + x] = []
vertices[y * xverticesnumber + x].append(xoffset + x * stretch) # 0: x
vertices[y * xverticesnumber + x].append(yoffset + y * stretch) # 1: y
vertices[y * xverticesnumber + x].append(minheight) # 2: height
vertices[y * xverticesnumber + x].append(0) # 3: triangulation value
vertices[y * xverticesnumber + x].append(0) # 4: R
vertices[y * xverticesnumber + x].append(0) # 5: G
vertices[y * xverticesnumber + x].append(0) # 6: B
fill()
file.close()
# sort triangles
print("sort")
var i = 0
# triangles.resize(2*len(vertices))
for y in range(yverticesnumber-1):
for x in range(xverticesnumber-1):
var b = (vertices[y * xverticesnumber + x][3] & 7) % 128
if b == 4 or b == 5 or b == 7:
triangles.append(vertices[(y+1) * xverticesnumber + x])
triangles.append(vertices[y * xverticesnumber + x])
triangles.append(vertices[(y+1) * xverticesnumber + (x+1)])
if b == 5 or b == 3:
triangles.append(vertices[y * xverticesnumber + (x + 1)])
triangles.append(vertices[y * xverticesnumber + x])
triangles.append(vertices[(y + 1) * xverticesnumber + (x + 1)])
for y in range (yverticesnumber-1):
for x in range(xverticesnumber-1):
var b = (vertices[y * xverticesnumber + x][3] & 7) % 128
if b == 1 or b == 6:
triangles.append(vertices[(y + 1) * xverticesnumber + x])
triangles.append(vertices[y * xverticesnumber + x])
triangles.append(vertices[y * xverticesnumber + (x + 1)])
if b == 2 or b == 6:
triangles.append(vertices[y * xverticesnumber + (x + 1)])
triangles.append(vertices[(y + 1) * xverticesnumber + x])
triangles.append(vertices[(y + 1) * xverticesnumber + (x + 1)])

51
LICENSE.md Normal file
View File

@ -0,0 +1,51 @@
All parts of this project that are not copyrighted or licensed by someone else are released under the MIT License:
Copyright (c) 2018 Jaccomo Lorenz (Maujoe)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------
Other Files:
Some files caintained in this project may be generated by the Godot Engine version 3.x that is covered by its own license, an up to date version can be found on: https://github.com/godotengine/godot/blob/master/LICENSE.txt.
Quote (18th February 2018):
"Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE."

141
MeshInstance.gd Normal file
View File

@ -0,0 +1,141 @@
extends MeshInstance
var signature
var u0
var xoffset
var yoffset
var minheight
var maxheight
var xverticesnumber
var yverticesnumber
var stretch
var u1
var u2
var u3
var u4
var version
var u6
var u7
var u8
var tex
var edges
var file = File.new()
var vertices = []
var triangles = []
func _on_MeshInstance_ready():
readgti("res://default.gti")
var st = SurfaceTool.new()
st.begin(Mesh.PRIMITIVE_TRIANGLES)
for v in triangles:
st.add_color(Color(v[4] / 255.0, v[5] / 255.0, v[6] / 255.0))
st.add_vertex(Vector3(v[0], v[2], v[1]))
var m = st.commit()
mesh = m
func fill():
print("version="+str(version))
# fill read values
print("fill")
var p = 0
while p < xverticesnumber * yverticesnumber:
var b = file.get_8()
if b >= 0x80:
while b != 0x00:
if p >= xverticesnumber * yverticesnumber:
return
b = (b + 1) & 0xFF
p+=1
else:
while b != 0xff:
if p >= xverticesnumber * yverticesnumber:
return
if version != 7:
vertices[p][2] = file.get_float() # height
vertices[p][3] = file.get_8() # triangulation
vertices[p][4] = file.get_8() # R
vertices[p][5] = file.get_8() # G
vertices[p][6] = file.get_8() # B
else:
vertices[p][2] = file.get_float() # height
vertices[p][3] = file.get_8() # triangulation
vertices[p][4] = file.get_8() # R
vertices[p][5] = file.get_8() # G
vertices[p][6] = file.get_8() # B
var unk = file.get_8() # unk
# print("["+ str(vertices[p][0]) + ", "+ str(vertices[p][1])+", "+ str(vertices[p][2])+", "+ str(vertices[p][3])+", "+ str(vertices[p][4])+", "+ str(vertices[p][5])+", "+ str(vertices[p][6])+", "+str(b)+"]")
p+=1
b = (b - 1) & 0xFF
func readgti(filename):
file.open(filename, File.READ)
if not file.is_open():
get_tree().quit()
return
signature = file.get_32()
u0 = file.get_32()
xoffset = file.get_float()
yoffset = file.get_float()
minheight = file.get_float()
maxheight = file.get_float()
xverticesnumber = file.get_32()
yverticesnumber = file.get_32()
stretch = file.get_float()
u1 = file.get_float()
u2 = file.get_float()
u3 = file.get_float()
u4 = file.get_float()
version = file.get_16()
u6 = file.get_16()
u7 = file.get_float()
u8 = file.get_float()
tex = file.get_buffer(32).get_string_from_ascii()
vertices.resize(xverticesnumber * yverticesnumber)
# initialize empty terrain
print("init")
for y in range(yverticesnumber):
for x in range(xverticesnumber):
vertices[y * xverticesnumber + x] = []
vertices[y * xverticesnumber + x].append(xoffset + x * stretch) # 0: x
vertices[y * xverticesnumber + x].append(yoffset + y * stretch) # 1: y
vertices[y * xverticesnumber + x].append(minheight) # 2: height
vertices[y * xverticesnumber + x].append(0) # 3: triangulation value
vertices[y * xverticesnumber + x].append(0) # 4: R
vertices[y * xverticesnumber + x].append(0) # 5: G
vertices[y * xverticesnumber + x].append(0) # 6: B
fill()
file.close()
# sort triangles
print("sort")
var i = 0
# triangles.resize(2*len(vertices))
for y in range(yverticesnumber-1):
for x in range(xverticesnumber-1):
var b = (vertices[y * xverticesnumber + x][3] & 7) % 128
if b == 4 or b == 5 or b == 7:
triangles.append(vertices[(y+1) * xverticesnumber + x])
triangles.append(vertices[y * xverticesnumber + x])
triangles.append(vertices[(y+1) * xverticesnumber + (x+1)])
if b == 5 or b == 3:
triangles.append(vertices[y * xverticesnumber + (x + 1)])
triangles.append(vertices[y * xverticesnumber + x])
triangles.append(vertices[(y + 1) * xverticesnumber + (x + 1)])
for y in range (yverticesnumber-1):
for x in range(xverticesnumber-1):
var b = (vertices[y * xverticesnumber + x][3] & 7) % 128
if b == 1 or b == 6:
triangles.append(vertices[(y + 1) * xverticesnumber + x])
triangles.append(vertices[y * xverticesnumber + x])
triangles.append(vertices[y * xverticesnumber + (x + 1)])
if b == 2 or b == 6:
triangles.append(vertices[y * xverticesnumber + (x + 1)])
triangles.append(vertices[(y + 1) * xverticesnumber + x])
triangles.append(vertices[(y + 1) * xverticesnumber + (x + 1)])

7
MeshInstance.tscn Normal file
View File

@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://MeshInstance.gd" type="Script" id=1]
[node name="GiantsTerrain" type="MeshInstance"]
script = ExtResource( 1 )
[connection signal="ready" from="." to="." method="_on_MeshInstance_ready"]

12
README.md Normal file
View File

@ -0,0 +1,12 @@
# Basic Water Material
A basic water material for the Godot Engine 3.x.
#### Video/How To:
https://youtu.be/jbYrpKWTlpw
![Image](assets/maujoe.basic_water_material/screenshots/basic_water_material_1.jpg)
## License
All parts of this project that are not copyrighted or licensed by someone else are released free under the MIT License - see the LICENSE.md file for details.

1
UI.gd Normal file
View File

@ -0,0 +1 @@
extends Panel

63
UI.tscn Normal file
View File

@ -0,0 +1,63 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UI.gd" type="Script" id=1]
[node name="Panel" type="Panel"]
anchor_left = 0.000976562
anchor_top = 0.001
anchor_right = 0.000976562
anchor_bottom = 0.001
margin_left = -2.0
margin_top = -1.0
margin_right = 1023.0
margin_bottom = 600.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" type="Label" parent="."]
margin_left = 329.0
margin_top = 37.0
margin_right = 539.0
margin_bottom = 51.0
text = "Welcome to GiantsEditReloaded!"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="New" type="Button" parent="."]
margin_left = 153.0
margin_top = 150.0
margin_right = 268.0
margin_bottom = 179.0
rect_pivot_offset = Vector2( 82, 14.5 )
text = "Create new map"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Open" type="Button" parent="."]
margin_left = 366.0
margin_top = 149.0
margin_right = 481.0
margin_bottom = 178.0
rect_pivot_offset = Vector2( 82, 14.5 )
text = "Open map"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Quit" type="Button" parent="."]
margin_left = 614.0
margin_top = 149.0
margin_right = 729.0
margin_bottom = 178.0
rect_pivot_offset = Vector2( 82, 14.5 )
text = "Quit"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="New" to="." method="_on_Button_pressed"]
[connection signal="pressed" from="Open" to="." method="_on_Button_pressed"]
[connection signal="pressed" from="Quit" to="." method="_on_Button_pressed"]

33
Water.tscn Normal file
View File

@ -0,0 +1,33 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/maujoe.basic_water_material/materials/basic_water_material.material" type="Material" id=1]
[sub_resource type="PlaneMesh" id=1]
material = ExtResource( 1 )
size = Vector2( 50000, 50000 )
[sub_resource type="Animation" id=2]
resource_name = "uv_water"
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:mesh:material:uv1_offset")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( 1, 0, 0 ) ]
}
[node name="Water" type="MeshInstance"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.473385, 0 )
mesh = SubResource( 1 )
material/0 = null
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "uv_water"
playback_speed = 0.05
anims/uv_water = SubResource( 2 )

View File

@ -0,0 +1,51 @@
All parts of this project that are not copyrighted or licensed by someone else are released under the MIT License:
Copyright (c) 2018 Jaccomo Lorenz (Maujoe)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------
Other Files:
Some files caintained in this project may be generated by the Godot Engine version 3.x that is covered by its own license, an up to date version can be found on: https://github.com/godotengine/godot/blob/master/LICENSE.txt.
Quote (18th February 2018):
"Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE."

View File

@ -0,0 +1,12 @@
# Basic Water Material
A basic water material for the Godot Engine 3.x.
#### Video/How To:
https://youtu.be/jbYrpKWTlpw
![Image](screenshots/basic_water_material_1.jpg)
## License
All parts of this project that are not copyrighted or licensed by someone else are released free under the MIT License - see the LICENSE.md file for details.

View File

@ -0,0 +1,30 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/maujoe.basic_water_material/models/terrain.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/maujoe.basic_water_material/textures/cloud_layers_1k.hdr" type="Texture" id=2]
[ext_resource path="res://Water.tscn" type="PackedScene" id=3]
[sub_resource type="PanoramaSky" id=1]
radiance_size = 4
panorama = ExtResource( 2 )
[sub_resource type="Environment" id=2]
background_mode = 2
background_sky = SubResource( 1 )
background_energy = 1.5
fog_height_min = 0.0
fog_height_max = 100.0
ssao_quality = 0
[node name="Node" type="Node"]
[node name="terrain" parent="." instance=ExtResource( 1 )]
[node name="Camera" type="Camera" parent="."]
transform = Transform( 0.821155, 0, -0.570705, 0, 1, 0, 0.570705, 0, 0.821155, -10.0408, 1.29057, 13.15 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( 2 )
[node name="Water" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.14418, 0 )

View File

@ -0,0 +1,18 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
radiance_size = 4
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
sky_curve = 0.25
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
ground_curve = 0.01
sun_energy = 16.0
[resource]
background_mode = 2
background_sky = SubResource( 1 )
fog_height_min = 0.0
fog_height_max = 100.0
ssao_quality = 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-231110b88024ae42b05514bfd264b637.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/icon.png"
dest_files=[ "res://.import/icon.png-231110b88024ae42b05514bfd264b637.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/maujoe.basic_water_material/models/terrain.dae" type="PackedScene" id=1]
[ext_resource path="res://assets/maujoe.basic_water_material/textures/dirt.png" type="Texture" id=2]
[sub_resource type="SpatialMaterial" id=1]
render_priority = 0
flags_transparent = false
flags_unshaded = false
flags_vertex_lighting = false
flags_no_depth_test = false
flags_use_point_size = false
flags_world_triplanar = false
flags_fixed_size = false
flags_albedo_tex_force_srgb = false
vertex_color_use_as_albedo = false
vertex_color_is_srgb = false
params_diffuse_mode = 0
params_specular_mode = 0
params_blend_mode = 0
params_cull_mode = 0
params_depth_draw_mode = 0
params_line_width = 1.0
params_point_size = 1.0
params_billboard_mode = 0
params_grow = false
params_use_alpha_scissor = false
albedo_color = Color( 1, 1, 1, 1 )
albedo_texture = ExtResource( 2 )
metallic = 0.0
metallic_specular = 0.5
metallic_texture_channel = 0
roughness = 1.0
roughness_texture_channel = 0
emission_enabled = false
normal_enabled = false
rim_enabled = false
clearcoat_enabled = false
anisotropy_enabled = false
ao_enabled = false
depth_enabled = false
subsurf_scatter_enabled = false
transmission_enabled = false
refraction_enabled = false
detail_enabled = false
uv1_scale = Vector3( 2, 2, 2 )
uv1_offset = Vector3( 0, 0, 0 )
uv1_triplanar = true
uv1_triplanar_sharpness = 1.0
uv2_scale = Vector3( 1, 1, 1 )
uv2_offset = Vector3( 0, 0, 0 )
uv2_triplanar = false
uv2_triplanar_sharpness = 1.0
proximity_fade_enable = false
distance_fade_enable = false
_sections_unfolded = [ "Roughness", "UV1" ]
[sub_resource type="CubeMesh" id=2]
size = Vector3( 2, 2, 2 )
subdivide_width = 0
subdivide_height = 0
subdivide_depth = 0
[sub_resource type="CylinderMesh" id=3]
top_radius = 1.0
bottom_radius = 1.0
height = 2.0
radial_segments = 64
rings = 4
[node name="terrain" index="0" instance=ExtResource( 1 )]
[node name="Plane" parent="." index="0"]
material/0 = SubResource( 1 )
_sections_unfolded = [ "material" ]
[node name="MeshInstance" type="MeshInstance" parent="." index="2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.611577, 2.08371 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 2 )
skeleton = NodePath("..")
material/0 = null
[node name="MeshInstance2" type="MeshInstance" parent="." index="3"]
transform = Transform( 0.865298, 0.433177, -0.252223, -0.501257, 0.747774, -0.435402, 0, 0.503182, 0.864181, -2.51833, -4.75691, -3.43013 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 2 )
skeleton = NodePath("..")
material/0 = null
[node name="MeshInstance3" type="MeshInstance" parent="." index="4"]
transform = Transform( -0.200505, -0.335063, -0.920614, 0.579423, 0.717171, -0.387214, 0.789979, -0.611064, 0.0503473, -4.13883, -4.1162, 4.76208 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 2 )
skeleton = NodePath("..")
material/0 = null
[node name="MeshInstance4" type="MeshInstance" parent="." index="5"]
transform = Transform( -0.935291, -0.0302122, -0.352587, 0.317867, -0.50963, -0.799524, -0.155533, -0.859863, 0.486256, 2.44717, -5.55065, -1.09404 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 3 )
skeleton = NodePath("..")
material/0 = null

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/basic_water_material.jpg-de524e8fcab79b2b9c9cdcb882945294.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/screenshots/basic_water_material.jpg"
dest_files=[ "res://.import/basic_water_material.jpg-de524e8fcab79b2b9c9cdcb882945294.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/basic_water_material_1.jpg-25100a1cb77e2417c01fa5507b8f1672.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/screenshots/basic_water_material_1.jpg"
dest_files=[ "res://.import/basic_water_material_1.jpg-25100a1cb77e2417c01fa5507b8f1672.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/basic_water_material_2.jpg-c2ef2cff07f0225e579abd8a197b794b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/screenshots/basic_water_material_2.jpg"
dest_files=[ "res://.import/basic_water_material_2.jpg-c2ef2cff07f0225e579abd8a197b794b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/basic_water_material_3.jpg-c587e71eb08a08a02a297d3334efe204.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/screenshots/basic_water_material_3.jpg"
dest_files=[ "res://.import/basic_water_material_3.jpg-c587e71eb08a08a02a297d3334efe204.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/basic_water_material_5.jpg-3946231ae011bce7b7162b46d1a9c1f8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/screenshots/basic_water_material_5.jpg"
dest_files=[ "res://.import/basic_water_material_5.jpg-3946231ae011bce7b7162b46d1a9c1f8.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/basic_water_material_6.jpg-393328d6fd88acbcc143143455f51c0b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/screenshots/basic_water_material_6.jpg"
dest_files=[ "res://.import/basic_water_material_6.jpg-393328d6fd88acbcc143143455f51c0b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/cloud_layers_1k.hdr-120b64acaa244e4436c31186a305491a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/textures/cloud_layers_1k.hdr"
dest_files=[ "res://.import/cloud_layers_1k.hdr-120b64acaa244e4436c31186a305491a.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 KiB

View File

@ -0,0 +1,36 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/dirt.png-2f6f9f55b644c74cdd0f99e41507ea61.s3tc.stex"
path.etc2="res://.import/dirt.png-2f6f9f55b644c74cdd0f99e41507ea61.etc2.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}
[deps]
source_file="res://assets/maujoe.basic_water_material/textures/dirt.png"
dest_files=[ "res://.import/dirt.png-2f6f9f55b644c74cdd0f99e41507ea61.s3tc.stex", "res://.import/dirt.png-2f6f9f55b644c74cdd0f99e41507ea61.etc2.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/water_normal_1.png-7e3a5f6b654ae6d69802a802595bdf49.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/maujoe.basic_water_material/textures/water_normal_1.png"
dest_files=[ "res://.import/water_normal_1.png-7e3a5f6b654ae6d69802a802595bdf49.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -0,0 +1,36 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/water_normal_2.png-4dc8dd7a6821e4087592d9c95e1f0755.s3tc.stex"
path.etc2="res://.import/water_normal_2.png-4dc8dd7a6821e4087592d9c95e1f0755.etc2.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}
[deps]
source_file="res://assets/maujoe.basic_water_material/textures/water_normal_2.png"
dest_files=[ "res://.import/water_normal_2.png-4dc8dd7a6821e4087592d9c95e1f0755.s3tc.stex", "res://.import/water_normal_2.png-4dc8dd7a6821e4087592d9c95e1f0755.etc2.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=1
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
default.gti Normal file

Binary file not shown.

10
default_env.tres Normal file
View File

@ -0,0 +1,10 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
radiance_size = 5
ground_bottom_color = Color( 0.862745, 0.858824, 0.858824, 1 )
ground_horizon_color = Color( 1, 1, 1, 1 )
[resource]
background_mode = 2
background_sky = SubResource( 1 )

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

34
icon.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

29
player/Player.tscn Normal file
View File

@ -0,0 +1,29 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://player/player_controller.gd" type="Script" id=1]
[ext_resource path="res://default_env.tres" type="Environment" id=2]
[sub_resource type="CapsuleShape" id=1]
radius = 0.6
height = 1.5
[node name="Player" type="KinematicBody" groups=[
"Player",
]]
collision_layer = 2
collision_mask = 3
script = ExtResource( 1 )
head_path = NodePath("Head")
cam_path = NodePath("Head/Camera")
[node name="Collision" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 )
shape = SubResource( 1 )
[node name="Head" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 )
[node name="Camera" type="Camera" parent="Head"]
environment = ExtResource( 2 )
fov = 80.0
far = 10000.0

170
player/player_controller.gd Normal file
View File

@ -0,0 +1,170 @@
extends KinematicBody
###################-VARIABLES-####################
# Camera
export var mouse_sensitivity := 10.0
export var head_path: NodePath
export var cam_path: NodePath
export var FOV := 80.0
var mouse_axis := Vector2()
onready var head: Spatial = get_node(head_path)
onready var cam: Camera = get_node(cam_path)
# Move
var velocity := Vector3()
var direction := Vector3()
var move_axis := Vector2()
var can_sprint := true
var sprinting := false
# Walk
const FLOOR_NORMAL := Vector3(0, 1, 0)
export var gravity := 30.0
export var walk_speed := 10
export var sprint_speed := 16
export var acceleration := 8
export var deacceleration := 10
export(float, 0.0, 1.0, 0.05) var air_control := 0.3
export var jump_height := 10
# Fly
export var fly_speed := 1000
export var fly_accel := 4
var flying := true
# Slopes
export var floor_max_angle := 45.0
##################################################
# Called when the node enters the scene tree
func _ready() -> void:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
cam.fov = FOV
# Called every frame. 'delta' is the elapsed time since the previous frame
func _process(_delta: float) -> void:
move_axis.x = Input.get_action_strength("move_forward") - Input.get_action_strength("move_backward")
move_axis.y = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
camera_rotation()
# Called every physics tick. 'delta' is constant
func _physics_process(delta: float) -> void:
if flying:
fly(delta)
else:
walk(delta)
# Called when there is an input event
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
mouse_axis = event.relative
func walk(delta: float) -> void:
# Input
direction = Vector3()
var aim: Basis = get_global_transform().basis
if move_axis.x >= 0.5:
direction -= aim.z
if move_axis.x <= -0.5:
direction += aim.z
if move_axis.y <= -0.5:
direction -= aim.x
if move_axis.y >= 0.5:
direction += aim.x
direction.y = 0
direction = direction.normalized()
# Jump
var _snap: Vector3
if is_on_floor():
_snap = Vector3(0, -1, 0)
if Input.is_action_just_pressed("move_jump"):
_snap = Vector3(0, 0, 0)
velocity.y = jump_height
# Apply Gravity
velocity.y -= gravity * delta
# Sprint
var _speed: int
if (Input.is_action_pressed("move_sprint") and can_sprint and move_axis.x == 1):
_speed = sprint_speed
cam.set_fov(lerp(cam.fov, FOV * 1.2, delta * 8))
sprinting = true
else:
_speed = walk_speed
cam.set_fov(lerp(cam.fov, FOV, delta * 8))
sprinting = false
# Acceleration and Deacceleration
# where would the player go
var _temp_vel: Vector3 = velocity
_temp_vel.y = 0
var _target: Vector3 = direction * _speed
var _temp_accel: float
if direction.dot(_temp_vel) > 0:
_temp_accel = acceleration
else:
_temp_accel = deacceleration
if not is_on_floor():
_temp_accel *= air_control
# interpolation
_temp_vel = _temp_vel.linear_interpolate(_target, _temp_accel * delta)
velocity.x = _temp_vel.x
velocity.z = _temp_vel.z
# clamping (to stop on slopes)
if direction.dot(velocity) == 0:
var _vel_clamp := 0.25
if velocity.x < _vel_clamp and velocity.x > -_vel_clamp:
velocity.x = 0
if velocity.z < _vel_clamp and velocity.z > -_vel_clamp:
velocity.z = 0
# Move
velocity.y = move_and_slide_with_snap(velocity, _snap, FLOOR_NORMAL,
true, 4, deg2rad(floor_max_angle)).y
func fly(delta: float) -> void:
# Input
direction = Vector3()
var aim = head.get_global_transform().basis
if move_axis.x == 1:
direction -= aim.z
if move_axis.x == -1:
direction += aim.z
if move_axis.y == -1:
direction -= aim.x
if move_axis.y == 1:
direction += aim.x
direction = direction.normalized()
# Acceleration and Deacceleration
var target: Vector3 = direction * fly_speed
velocity = velocity.linear_interpolate(target, fly_accel * delta)
# Move
velocity = move_and_slide(velocity)
func camera_rotation() -> void:
if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
return
if mouse_axis.length() > 0:
var _smoothness := 80
# Get mouse delta
var horizontal: float = -(mouse_axis.x * mouse_sensitivity) / _smoothness
var vertical: float = -(mouse_axis.y * mouse_sensitivity) / _smoothness
mouse_axis = Vector2()
rotate_y(deg2rad(horizontal))
head.rotate_x(deg2rad(vertical))
# Clamp mouse rotation
var temp_rot: Vector3 = head.rotation_degrees
temp_rot.x = clamp(temp_rot.x, -90, 90)
head.rotation_degrees = temp_rot

68
project.godot Normal file
View File

@ -0,0 +1,68 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="GiantsEdit"
run/main_scene="res://3d.tscn"
config/icon="res://icon.png"
[display]
window/size/resizable=false
window/stretch/mode="viewport"
window/stretch/aspect="expand"
[input]
move_forward={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null)
]
}
move_backward={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
]
}
move_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":81,"unicode":0,"echo":false,"script":null)
]
}
move_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
]
}
move_sprint={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
]
}
move_jump={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
]
}
mouse_input={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777244,"unicode":0,"echo":false,"script":null)
]
}
[rendering]
environment/default_environment="res://default_env.tres"