Skip to content

Commit

Permalink
Camera movement and collision calculation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariasteam committed Jul 23, 2018
1 parent 055d2d1 commit 71554bb
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 36 deletions.
5 changes: 2 additions & 3 deletions Scenes/Column.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ layers = 1
params/enabled = true
params/editor_only = false
params/bake_mode = 1
params/energy = 0.65
params/energy = 0.5
colors/diffuse = Color( 1, 1, 1, 1 )
colors/specular = Color( 1, 1, 1, 1 )
shadow/shadow = false
Expand All @@ -81,7 +81,6 @@ shadow/zoffset_scale = 2.0

[node name="Spatial" parent="." instance=ExtResource( 6 )]

transform/local = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.83688, 17.7, 2.56991 )
visibility/visible = false
transform/local = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.83688, 17.4298, 2.56991 )


30 changes: 21 additions & 9 deletions Scenes/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ onready var ball = get_node ("RigidBody/Axis/Group/Ball")
onready var area = get_node ("RigidBody/Axis/Group/Area")
onready var rigid_2 = get_node("RigidBody2")
onready var light = get_node("RigidBody/Axis/Group/OmniLight")
onready var decal_raycast = get_node("RigidBody/Axis/DecalRayCast")

onready var camera_axis = get_node ("RigidBody2/CameraAxis")

Expand Down Expand Up @@ -78,9 +79,17 @@ func die():
area.queue_free()

get_node("Timer").start()


func block_camera():
rigid_2.set_sleeping(true)

func release_camera():
rigid_2.set_sleeping(false)

func on_platform_passed():
release_camera()
rigid_2.set_linear_velocity(rigid.get_linear_velocity())

unlimit_rotation_range()
global.update_points((counter + 1) * 10)
global.update_progress()
Expand All @@ -96,9 +105,7 @@ func on_platform_passed():
if (meteor_charged):
meteor_particles.set_emitting(true)
meteorize()

rigid_2.set_sleeping(false)
rigid_2.set_linear_velocity(rigid.get_linear_velocity())


func lock_rot():
last_safe_rotation = axis.get_rotation_deg()
Expand Down Expand Up @@ -152,7 +159,7 @@ func end_animation():
die_particles.set_emitting(true)


func _on_Area_body_enter(body):
func _on_Area_body_enter(body):
rigid.set_linear_velocity(Vector3(0,0,0))

light.set_enabled(false)
Expand All @@ -164,9 +171,9 @@ func _on_Area_body_enter(body):
if (!meteor_charged):
meteor_charged = true

if (body.is_in_group ("bad") && !meteor):
print ("SD")
if (!meteor && decal_raycast.is_colliding() and decal_raycast.get_collider().is_in_group("bad")):
die()

else:
if (meteor):
unlimit_rotation_range()
Expand All @@ -175,13 +182,15 @@ func _on_Area_body_enter(body):
body.get_parent().get_parent().get_parent().get_parent().meteorize()
meteor_charged = false
big_splash.set_emitting(true)
rigid_2.apply_impulse(Vector3(0,0,0), Vector3(0,100,0))
rigid_2.apply_impulse(Vector3(0,0,0), Vector3(0,120,0))
release_camera()
rigid_2.apply_impulse(Vector3(0,0,0), Vector3(0,120,0))
else:
jump_sound.play(0)
var aux = decal.instance()
body.get_parent().add_child(aux)
var tr = aux.get_global_transform()
tr.origin = get_node("RigidBody/Axis/DecalRayCast").get_collision_point()
tr.origin = decal_raycast.get_collision_point()
aux.set_global_transform(tr)
aux.rotate_y(rand_range(0, 360))
aux.translate(Vector3(0,0.0001,0))
Expand Down Expand Up @@ -214,3 +223,6 @@ func _on_Timer_timeout():
func _on_Area_body_exit( body ):
colliding = false

func _on_Area_area_enter( area ):
if (area.is_in_group("deleter") and !meteor):
block_camera()
47 changes: 37 additions & 10 deletions Scenes/Player.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tracks/0/keys = {

[sub_resource type="BoxShape" id=4]

extents = Vector3( 0.171634, 0.185585, 0.128776 )
extents = Vector3( 0.171634, 0.101157, 0.128776 )

[sub_resource type="CubeMap" id=5]

Expand Down Expand Up @@ -108,8 +108,8 @@ shape_count = 1
shapes/0/shape = SubResource( 1 )
shapes/0/transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.42167, 0 )
shapes/0/trigger = true
collision/layers = 5
collision/mask = 5
collision/layers = 4
collision/mask = 4
mode = 2
mass = 3.06122
friction = 1.0
Expand Down Expand Up @@ -141,6 +141,7 @@ _import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )

[node name="Group" type="Spatial" parent="RigidBody/Axis"]

editor/display_folded = true
_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0.10596 )

Expand Down Expand Up @@ -635,9 +636,9 @@ params/attenuation = 1.0
[node name="DecalRayCast" type="RayCast" parent="RigidBody/Axis"]

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6, 3.70208 )
transform/local = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.514403, 3.70208 )
enabled = true
cast_to = Vector3( 0, -10000, 0 )
cast_to = Vector3( 0, -1, 0 )
layer_mask = 8
type_mask = 1

Expand Down Expand Up @@ -690,10 +691,10 @@ input/ray_pickable = true
input/capture_on_drag = false
shape_count = 1
shapes/0/shape = SubResource( 4 )
shapes/0/transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0782349, 0.0397879 )
shapes/0/transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01509, 0.0397879 )
shapes/0/trigger = true
collision/layers = 7
collision/mask = 7
collision/layers = 0
collision/mask = 0
mode = 2
mass = 3.06122
friction = 0.0
Expand All @@ -711,10 +712,32 @@ velocity/angular = Vector3( 0, 0, 0 )
damp_override/linear = -1.0
damp_override/angular = -1.0

[node name="CollisionShape" type="CollisionShape" parent="RigidBody2"]
[node name="Area" type="Area" parent="RigidBody2"]

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0782349, 0.0397879 )
input/ray_pickable = false
input/capture_on_drag = false
shape_count = 1
shapes/0/shape = SubResource( 4 )
shapes/0/transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01509, 0.0397879 )
shapes/0/trigger = true
space_override = 0
gravity_point = false
gravity_distance_scale = 0.0
gravity_vec = Vector3( 0, -1, 0 )
gravity = 9.8
linear_damp = 0.1
angular_damp = 1.0
priority = 0.0
monitoring = true
monitorable = true
collision/layers = 4
collision/mask = 4

[node name="CollisionShape" type="CollisionShape" parent="RigidBody2/Area"]

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01509, 0.0397879 )
shape = SubResource( 4 )
trigger = true
_update_shape_index = 0
Expand Down Expand Up @@ -749,4 +772,8 @@ enabled = true

[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

[connection signal="area_enter" from="RigidBody2/Area" to="." method="_on_Area_area_enter"]

[connection signal="area_exit" from="RigidBody2/Area" to="." method="_on_Area_area_exit"]


2 changes: 1 addition & 1 deletion Scenes/Segment_Double.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func _ready():
set_process(true)

func _process(delta):
rotate(Vector3(0,1,0), velocity * 0.0003)
rotate(Vector3(0,1,0), velocity * 0.003)

func set_material(material):
get_node("REGULAR").set_material_override(material)
Expand Down
2 changes: 1 addition & 1 deletion Scenes/Segment_Double.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ script/script = ExtResource( 1 )
[node name="REGULAR" type="MeshInstance" parent="."]

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 2.05, 0, 0, 0, 4, 0, 0, 0, 2.05, 0, -0.5, 0 )
transform/local = Transform( 2.05, 0, 0, 0, 1.7, 0, 0, 0, 2.05, 0, -0.5, 0 )
layers = 1
geometry/visible = true
geometry/material_override = null
Expand Down
1 change: 1 addition & 0 deletions Scenes/decal.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ textures/shade_param_tc = 0
[node name="Quad" type="Quad"]

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 1.4, 0, 0, 0, 1.4, 0, 0, 0, 1.4, 0, 0, 0 )
layers = 1
geometry/visible = true
geometry/material_override = SubResource( 1 )
Expand Down
5 changes: 3 additions & 2 deletions Scenes/end_line.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plane = Plane( 0, 1, 0, 0 )

[node name="Area" type="Area" groups=[
"end_line",
"deleter",
]]

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
Expand All @@ -28,8 +29,8 @@ angular_damp = 0.0
priority = 0.0
monitoring = true
monitorable = true
collision/layers = 2
collision/mask = 2
collision/layers = 6
collision/mask = 6
script/script = ExtResource( 1 )

[node name="CollisionShape" type="CollisionShape" parent="."]
Expand Down
9 changes: 5 additions & 4 deletions Scenes/first_platform.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ velocity = 0.0

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )

[node name="Area" type="Area" parent="."]
[node name="Area" type="Area" parent="." groups=[
"deleter",
]]

editor/display_folded = true
_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.240012, 0 )
input/ray_pickable = false
Expand All @@ -38,8 +39,8 @@ angular_damp = 1.0
priority = 0.0
monitoring = true
monitorable = true
collision/layers = 5
collision/mask = 5
collision/layers = 4
collision/mask = 4

[node name="CollisionShape" type="CollisionShape" parent="Area"]

Expand Down
5 changes: 2 additions & 3 deletions Scenes/platform.gd
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func _on_Init_body_enter( body ):

func _on_Deleter_body_enter( body ):
if (!body.is_in_group("camera")):
body.get_parent().on_platform_passed()
body.get_parent().on_platform_passed()
explode()
else:
body.set_sleeping(true)

8 changes: 5 additions & 3 deletions Scenes/platform.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ velocity = 0.0
_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )

[node name="Deleter" type="Area" parent="."]
[node name="Deleter" type="Area" parent="." groups=[
"deleter",
]]

editor/display_folded = true
_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, -0.987758, 0 )
input/ray_pickable = false
input/capture_on_drag = false
shape_count = 1
shapes/0/shape = SubResource( 1 )
shapes/0/transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
shapes/0/transform = Transform( 1.18442, 0, 0, 0, 1.18442, 0, 0, 0, 1.18442, 0, -0.0609525, 0 )
shapes/0/trigger = false
space_override = 0
gravity_point = false
Expand All @@ -46,6 +47,7 @@ collision/mask = 4
[node name="CollisionShape" type="CollisionShape" parent="Deleter"]

_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 1.18442, 0, 0, 0, 1.18442, 0, 0, 0, 1.18442, 0, -0.0609525, 0 )
shape = SubResource( 1 )
trigger = false
_update_shape_index = 0
Expand Down
1 change: 1 addition & 0 deletions engine.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ global="*res://global.gd"

[debug]

force_fps=60
indicators_enabled=true
collision_shape_color=#7f0099b2
collision_contact_color=#ccff3319
Expand Down

0 comments on commit 71554bb

Please sign in to comment.