From db7b6b9186ff060b9bdf0560f261d31067428ad6 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 20 Sep 2015 13:03:46 -0300 Subject: [PATCH] Ability to visually debug geometry visually: -Visible 2D and 3D Shapes, Polygons, Tile collisions, etc. -Visible Navmesh and Navpoly -Visible collision contacts for 2D and 3D as a red point -Customizable colors in project settings --- 2d/platformer/enemy.xml | 345 ++++++++++++++++++++-------------------- 3d/platformer/player.gd | 6 +- 2 files changed, 178 insertions(+), 173 deletions(-) diff --git a/2d/platformer/enemy.xml b/2d/platformer/enemy.xml index 470797db..ad3a7093 100644 --- a/2d/platformer/enemy.xml +++ b/2d/platformer/enemy.xml @@ -1,10 +1,10 @@ - - - - - - + + + + + + 0 14 @@ -21,6 +21,8 @@ "cont" False + "times" + 0, 0.75, 1.5, 2.25, 3, 3.75, 4.5, 5.25, 6, 6.75 "transitions" 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 "values" @@ -36,8 +38,33 @@ 7 5 + + + + + "walk" + 1.25 + True + 0.25 + "value" + "sprite:frame" + 1 + + "cont" + False "times" - 0, 0.75, 1.5, 2.25, 3, 3.75, 4.5, 5.25, 6, 6.75 + 0, 0.25, 0.5, 0.75, 1, 1.25 + "transitions" + 1, 1, 1, 1, 1, 1 + "values" + + 0 + 1 + 2 + 3 + 4 + 0 + @@ -52,6 +79,8 @@ "cont" True + "times" + 3.58422, 4.33851 "transitions" 1, 1 "values" @@ -59,8 +88,6 @@ 1 0 - "times" - 3.58422, 4.33851 "value" "sprite:frame" @@ -68,14 +95,14 @@ "cont" True + "times" + 0 "transitions" 1 "values" 4 - "times" - 0 "value" "Particles2D:config/emitting" @@ -83,19 +110,21 @@ "cont" False + "times" + 3.47394 "transitions" 1 "values" True - "times" - 3.47394 "method" "." 1 + "times" + 3.20357, 5.07305 "transitions" 1, 1 "values" @@ -115,36 +144,12 @@ "_die" - "times" - 3.20357, 5.07305 - - "walk" - 1.25 - True - 0.25 - "value" - "sprite:frame" - 1 - - "cont" - False - "transitions" - 1, 1, 1, 1, 1, 1 - "values" - - 0 - 1 - 2 - 3 - 4 - 0 - - "times" - 0, 0.25, 0.5, 0.75, 1, 1.25 - + + 0, 1 + 1, 0.884956, 0.823009, 1, 0.768627, 0.389381, 0, 0 @@ -154,7 +159,7 @@ "pitch" 1 "sample" - + "db" @@ -162,24 +167,21 @@ "pitch" 1 "sample" - + + "conn_count" + 0 + "conns" + "names" - + "enemy" "RigidBody2D" - "visibility/visible" - "visibility/opacity" - "visibility/self_opacity" - "visibility/on_top" - "transform/pos" - "transform/rot" - "transform/scale" - "shape_count" + "input/pickable" "shapes/0/shape" "shapes/0/transform" "shapes/0/trigger" @@ -189,71 +191,71 @@ "shapes/2/shape" "shapes/2/transform" "shapes/2/trigger" + "collision/layers" + "collision/mask" "mode" "mass" "friction" "bounce" + "gravity_scale" "custom_integrator" "continuous_cd" "contacts_reported" "contact_monitor" - "active" + "sleeping" "can_sleep" "velocity/linear" "velocity/angular" + "damp_override/linear" + "damp_override/angular" "script/script" "__meta__" "enabler" "VisibilityEnabler2D" + "transform/pos" + "transform/scale" "rect" "enabler/pause_animations" "enabler/freeze_bodies" + "enabler/pause_particles" + "enabler/process_parent" + "enabler/fixed_process_parent" "anim" "AnimationPlayer" "playback/process_mode" "playback/default_blend_time" "root/root" "anims/idle" - "anims/explode" "anims/walk" + "anims/explode" "playback/active" "playback/speed" "blend_times" "autoplay" - "CollisionShape2D" - "shape" - "trigger" - "CollisionShape2D 2" - "CollisionShape2D 3" "sprite" "Sprite" "texture" - "centered" - "offset" - "flip_h" - "flip_v" - "vframes" "hframes" "frame" - "modulate" - "region" - "region_rect" + "CollisionShape2D" + "shape" + "trigger" + "_update_shape_index" + "CollisionShape2D 2" + "CollisionShape2D 3" "raycast_left" "RayCast2D" "enabled" "cast_to" + "layer_mask" "raycast_right" "Particles2D" + "visibility/self_opacity" "visibility/blend_mode" "config/amount" "config/lifetime" - "config/time_scale" - "config/preprocess" "config/emit_timeout" "config/emitting" - "config/offset" - "config/half_extents" - "config/local_space" "config/explosiveness" "config/texture" "params/direction" @@ -266,32 +268,14 @@ "params/radial_accel" "params/tangential_accel" "params/damping" + "params/initial_angle" "params/initial_size" "params/final_size" "params/hue_variation" - "randomness/direction" - "randomness/spread" - "randomness/linear_velocity" + "params/anim_speed_scale" + "params/anim_initial_pos" "randomness/spin_velocity" - "randomness/orbit_velocity" - "randomness/gravity_direction" - "randomness/gravity_strength" - "randomness/radial_accel" - "randomness/tangential_accel" - "randomness/damping" - "randomness/initial_size" - "randomness/final_size" - "randomness/hue_variation" - "color_phases/count" - "phase_0/pos" - "phase_0/color" - "phase_1/pos" - "phase_1/color" - "phase_2/pos" - "phase_2/color" - "phase_3/pos" - "phase_3/color" - "emission_points" + "color/color_ramp" "sound" "SamplePlayer2D" "params/volume_db" @@ -303,125 +287,154 @@ "config/samples" "config/pitch_random" - "version" - 1 - "conn_count" - 0 "node_count" 11 + "nodes" + -1, -1, 1, 0, -1, 29, 2, 0, 3, 1, 4, 2, 5, 0, 6, 1, 7, 3, 8, 0, 9, 1, 10, 4, 11, 0, 12, 5, 13, 5, 14, 6, 15, 7, 16, 8, 17, 8, 18, 7, 19, 0, 20, 9, 21, 10, 22, 0, 23, 0, 24, 11, 25, 12, 26, 8, 27, 13, 28, 13, 29, 14, 30, 15, 0, 0, 0, 32, 31, -1, 8, 33, 16, 34, 17, 35, 18, 36, 11, 37, 11, 38, 11, 39, 0, 40, 0, 0, 0, 0, 42, 41, -1, 10, 43, 5, 44, 8, 45, 19, 46, 20, 47, 21, 48, 22, 49, 11, 50, 23, 51, 24, 52, 25, 0, 0, 0, 54, 53, -1, 3, 55, 26, 56, 27, 57, 10, 0, 0, 0, 58, 58, -1, 4, 33, 28, 59, 1, 60, 0, 61, 29, 0, 0, 0, 58, 62, -1, 4, 33, 30, 59, 1, 60, 0, 61, 29, 0, 0, 0, 58, 63, -1, 4, 33, 31, 59, 1, 60, 0, 61, 29, 0, 0, 0, 65, 64, -1, 4, 33, 32, 66, 11, 67, 33, 68, 5, 0, 0, 0, 65, 69, -1, 4, 33, 34, 66, 11, 67, 33, 68, 5, 0, 0, 0, 70, 70, -1, 26, 71, 35, 72, 5, 73, 36, 74, 37, 75, 37, 76, 0, 77, 38, 78, 39, 79, 8, 80, 40, 81, 41, 82, 42, 83, 8, 84, 8, 85, 43, 86, 8, 87, 8, 88, 8, 89, 8, 90, 42, 91, 23, 92, 8, 93, 7, 94, 8, 95, 7, 96, 44, 0, 0, 0, 98, 97, -1, 8, 99, 8, 100, 7, 101, 7, 102, 45, 103, 7, 104, 46, 105, 47, 106, 8, 0 "variants" - - True - 1 - 0, 0 - 0 - 1, 1 - 3 + + False 1, -0, 0, 1, -1.08072, -2.16144 - False 1, -0, 0, 1, 6.48431, 3.24216 1, -0, 0, 1, -12.495, 3.53415 + 1 2 + 1 + 0 + 0 4 - + True + 0, 0 + -1 + + "__editor_plugin_screen__" + "2D" "__editor_plugin_states__" - "Script" - - "current" - 0 - "sources" - - "res://enemy.gd" - - "2D" - "pixel_snap" - False - "zoom" - 1.108033 "ofs" -227.625, -197.9 + "snap_grid" + False + "snap_offset" + 0, 0 + "snap_pixel" + False + "snap_relative" + False + "snap_rotation" + False + "snap_rotation_offset" + 0 + "snap_rotation_step" + 0.261799 + "snap_show_grid" + False + "snap_step" + 10, 10 + "zoom" + 1.108033 "3D" - "zfar" - 500 + "ambient_light_color" + 0.15, 0.15, 0.15, 1 + "default_light" + True + "default_srgb" + False + "deflight_rot_x" + 0.942478 + "deflight_rot_y" + 0.628319 "fov" 45 + "show_grid" + True + "show_origin" + True + "viewport_mode" + 1 "viewports" "distance" 4 + "listener" + True + "pos" + 0, 0, 0 + "use_environment" + False + "use_orthogonal" + False "x_rot" 0 "y_rot" 0 - "use_orthogonal" - False - "use_environment" - False - "pos" - 0, 0, 0 "distance" 4 + "listener" + False + "pos" + 0, 0, 0 + "use_environment" + False + "use_orthogonal" + False "x_rot" 0 "y_rot" 0 - "use_orthogonal" - False - "use_environment" - False - "pos" - 0, 0, 0 "distance" 4 + "listener" + False + "pos" + 0, 0, 0 + "use_environment" + False + "use_orthogonal" + False "x_rot" 0 "y_rot" 0 - "use_orthogonal" - False - "use_environment" - False - "pos" - 0, 0, 0 "distance" 4 + "listener" + False + "pos" + 0, 0, 0 + "use_environment" + False + "use_orthogonal" + False "x_rot" 0 "y_rot" 0 - "use_orthogonal" - False - "use_environment" - False - "pos" - 0, 0, 0 - "viewport_mode" - 1 - "default_light" - True - "show_grid" - True - "show_origin" - True + "zfar" + 500 "znear" 0.1 + "Anim" + + "visible" + False + "__editor_run_settings__" @@ -430,28 +443,24 @@ "run_mode" 0 - "__editor_plugin_screen__" - "2D" 16.2569, 11.0034 23.5056, 10.8629 -10, -10, 20, 20 - 1 ".." - + 3 "" + + 8 -1.08072, -2.16144 + -1 6.48431, 3.24216 -12.495, 3.53415 - - 8 - 1, 1, 1, 1 - 0, 0, 0, 0 -33.2868, -9.34363 0, 45 29.1987, -9.34363 @@ -459,22 +468,18 @@ 32 0.5 0.1 - + 180 90 2 9.8 - 1, 0.884956, 0.823009, 1 - 0.768627, 0.389381, 0, 0 - 0, 0, 0, 1 - + 2048 + 3 - "nodes" - -1, -1, 1, 0, -1, 31, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12, 8, 13, 6, 14, 9, 15, 8, 16, 6, 17, 10, 18, 8, 19, 11, 20, 1, 21, 3, 22, 3, 23, 8, 24, 8, 25, 12, 26, 8, 27, 0, 28, 0, 29, 2, 30, 3, 31, 13, 32, 14, 0, 0, 0, 34, 33, -1, 10, 2, 0, 3, 1, 4, 1, 5, 0, 6, 15, 7, 3, 8, 16, 35, 17, 36, 0, 37, 0, 0, 0, 0, 39, 38, -1, 10, 40, 18, 41, 3, 42, 19, 43, 20, 44, 21, 45, 22, 46, 0, 47, 23, 48, 24, 49, 25, 0, 0, 0, 50, 50, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 26, 7, 3, 8, 4, 51, 6, 52, 8, 0, 0, 0, 50, 53, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 27, 7, 3, 8, 4, 51, 6, 52, 8, 0, 0, 0, 50, 54, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 28, 7, 3, 8, 4, 51, 6, 52, 8, 0, 0, 0, 56, 55, -1, 18, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 57, 29, 58, 0, 59, 2, 60, 8, 61, 8, 62, 18, 63, 30, 64, 12, 65, 31, 66, 8, 67, 32, 0, 0, 0, 69, 68, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 33, 7, 3, 8, 4, 70, 0, 71, 34, 0, 0, 0, 69, 72, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 35, 7, 3, 8, 4, 70, 0, 71, 34, 0, 0, 0, 73, 73, -1, 55, 2, 0, 3, 1, 4, 36, 5, 0, 74, 18, 6, 2, 7, 3, 8, 4, 75, 37, 76, 38, 77, 1, 78, 3, 79, 38, 80, 8, 81, 2, 82, 2, 83, 0, 84, 39, 85, 40, 86, 3, 87, 41, 88, 42, 89, 43, 90, 3, 91, 3, 92, 44, 93, 3, 94, 3, 95, 3, 96, 43, 97, 23, 98, 3, 99, 3, 100, 3, 101, 3, 102, 1, 103, 3, 104, 3, 105, 3, 106, 3, 107, 3, 108, 3, 109, 3, 110, 3, 111, 3, 112, 11, 113, 3, 114, 45, 115, 1, 116, 46, 117, 1, 118, 47, 119, 1, 120, 47, 121, 48, 0, 0, 0, 123, 122, -1, 15, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 124, 3, 125, 1, 126, 1, 127, 49, 128, 1, 129, 5, 130, 50, 131, 3, 0 - "conns" - + "version" + 1 diff --git a/3d/platformer/player.gd b/3d/platformer/player.gd index 4eeb12e2..76cf2861 100644 --- a/3d/platformer/player.gd +++ b/3d/platformer/player.gd @@ -69,9 +69,9 @@ func _integrate_forces( state ): var lv = state.get_linear_velocity() # linear velocity var g = state.get_total_gravity() var delta = state.get_step() - var d = 1.0 - delta*state.get_total_density() - if (d<0): - d=0 +# var d = 1.0 - delta*state.get_total_density() +# if (d<0): +# d=0 lv += g * delta #apply gravity var anim = ANIM_FLOOR