Made some changes for latest Godot

- Character is now Spatial, KinematicBody doesn't move correctly
- Custom provider runs in tool mode for editor preview
- Added heightmap, replaces default wavy terrain, waiting for OpenSimplex
- Import files not-so-relevant changes
master
Marc Gilleron 2017-09-10 18:01:16 +02:00
parent 13fc866b6a
commit 83e50483e7
10 changed files with 44 additions and 32 deletions

View File

@ -7,6 +7,7 @@ const COLLISION_LAYER_AVATAR = 2
var _terrain = null
var _cursor = null
onready var _head = get_parent().get_node("Camera")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://character_controller.gd" type="Script" id=1]
[ext_resource path="res://mouse_look.gd" type="Script" id=2]
@ -6,18 +6,14 @@
[ext_resource path="res://crosshair.png" type="Texture" id=4]
[ext_resource path="res://center.gd" type="Script" id=5]
[sub_resource type="CapsuleShape" id=1]
radius = 0.4
height = 0.85
[sub_resource type="SpatialMaterial" id=2]
[sub_resource type="SpatialMaterial" id=1]
flags_transparent = false
flags_unshaded = false
flags_vertex_lighting = false
flags_on_top = false
flags_no_depth_test = false
flags_use_point_size = false
flags_world_triplanar = false
flags_fixed_size = false
vertex_color_use_as_albedo = true
vertex_color_is_srgb = false
@ -45,6 +41,7 @@ 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( 1, 1, 1 )
@ -56,20 +53,15 @@ uv2_offset = Vector3( 0, 0, 0 )
uv2_triplanar = false
uv2_triplanar_sharpness = 1.0
[sub_resource type="CubeMesh" id=3]
[sub_resource type="CubeMesh" id=2]
size = Vector3( 0.8, 1.8, 0.8 )
subdivide_width = 0
subdivide_height = 0
subdivide_depth = 0
[node name="CharacterAvatar" type="KinematicBody"]
[node name="CharacterAvatar" type="Spatial"]
input_ray_pickable = true
input_capture_on_drag = false
collision_layer = 3
collision_mask = 1
collision/safe_margin = 0.001
script = ExtResource( 1 )
speed = 5.0
gravity = 40.0
@ -77,12 +69,6 @@ jump_force = 8.0
head = NodePath("Camera")
terrain = null
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 )
shape = SubResource( 1 )
disabled = false
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.702764, 0 )
@ -91,7 +77,7 @@ fov = 90.0
near = 0.1
far = 500.0
keep_aspect = 1
current = false
current = true
cull_mask = 1048575
environment = null
h_offset = 0.0
@ -109,7 +95,7 @@ distance = 4.0
script = ExtResource( 3 )
terrain_path = null
cursor_material = SubResource( 2 )
cursor_material = SubResource( 1 )
[node name="debug_label" type="Label" parent="."]
@ -146,7 +132,6 @@ shadow_enabled = false
shadow_color = Color( 0, 0, 0, 1 )
shadow_bias = 0.1
shadow_contact = 0.0
shadow_max_distance = 0.0
shadow_reverse_cull_face = false
editor_only = false
omni_range = 10.0
@ -165,7 +150,7 @@ lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 3 )
mesh = SubResource( 2 )
skeleton = NodePath("..")
material/0 = null

View File

@ -1,4 +1,4 @@
extends KinematicBody
extends Spatial
const BoxPhysics = preload("res://box_physics.gd")
@ -132,7 +132,10 @@ func move_with_box_physics(motion):
z += 1
motion = BoxPhysics.get_motion(box, motion, potential_boxes)
move(motion)
# TODO If any Godot physics is used here, it will break box physics and you'll fall through the map!
# TODO Latest KinematicBody fucks up my motion, no idea why. Changed to Spatial
#move_and_slide(motion)
global_translate(motion)
return motion

View File

@ -8,6 +8,8 @@ path="res://.import/crosshair.png-b7f9cb2e0fc32a087972fec001d3421e.stex"
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
@ -15,6 +17,8 @@ flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -8,6 +8,8 @@ path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
@ -15,6 +17,8 @@ flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=true
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -143,8 +143,9 @@ voxels/1 = SubResource( 4 )
flags_transparent = false
flags_unshaded = false
flags_vertex_lighting = false
flags_on_top = false
flags_no_depth_test = false
flags_use_point_size = false
flags_world_triplanar = false
flags_fixed_size = false
vertex_color_use_as_albedo = false
vertex_color_is_srgb = false
@ -172,6 +173,7 @@ 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( 1, 1, 1 )
@ -188,8 +190,9 @@ uv2_triplanar_sharpness = 1.0
flags_transparent = false
flags_unshaded = true
flags_vertex_lighting = false
flags_on_top = false
flags_no_depth_test = false
flags_use_point_size = false
flags_world_triplanar = false
flags_fixed_size = false
vertex_color_use_as_albedo = true
vertex_color_is_srgb = false
@ -217,6 +220,7 @@ 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( 1, 1, 1 )
@ -286,7 +290,6 @@ shadow_enabled = true
shadow_color = Color( 0, 0, 0, 1 )
shadow_bias = 0.1
shadow_contact = 0.0
shadow_max_distance = 100.0
shadow_reverse_cull_face = false
editor_only = false
directional_shadow_mode = 2
@ -295,11 +298,14 @@ directional_shadow_split_2 = 0.2
directional_shadow_split_3 = 0.5
directional_shadow_blend_splits = false
directional_shadow_normal_bias = 0.1
directional_shadow_bias_split_scale = 0.25
directional_shadow_depth_range = 0
directional_shadow_max_distance = 200.0
_sections_unfolded = [ "Directional Shadow", "Light", "Shadow" ]
[node name="CharacterAvatar" parent="." instance=ExtResource( 6 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 25, 17 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 58.0914, 17 )
terrain = NodePath("../VoxelTerrain")
[node name="axes" parent="." instance=ExtResource( 7 )]

View File

@ -21,4 +21,4 @@ process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
scale=1.0
svg/scale=1.0

View File

@ -15,6 +15,10 @@ name="Voxel Game"
main_scene="res://main.tscn"
icon="res://icon.png"
[gdnative]
singletons=[ ]
[input]
action1=[ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)

View File

@ -1,3 +1,4 @@
tool
extends VoxelProvider

View File

@ -8,6 +8,8 @@ path="res://.import/terrain.png-84a626877af7de08ecf24965bda52835.stex"
compress/mode=3
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=true
flags/filter=false
flags/mipmaps=false
@ -15,6 +17,8 @@ flags/anisotropic=false
flags/srgb=0
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0