ggj2020

My game project for Global Game Jam 2020!
git clone git://git.hellocld.com/ggj2020
Log | Files | Refs

commit e489c0d30d636d069183f50d9004558eb1844f8c
parent e90d9402c33be92639f2d0c8511ec26238a93d9b
Author: Christopher Ray Langford <chris@hellocld.com>
Date:   Sat,  1 Feb 2020 12:30:39 -0500

Physics is working on grabbables again

Gotta remember to renable MODE_RIGID *after* resetting the parent and
transform stuff on release

Diffstat:
MGrabbable.gd | 5+++--
MSpatial.tscn | 15+--------------
2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/Grabbable.gd b/Grabbable.gd @@ -11,7 +11,7 @@ func is_grabbed(): func _on_grabbed(var hand:ARVRController): if _grabbed: return - set_mode(RigidBody.MODE_STATIC) + mode = RigidBody.MODE_STATIC get_parent().remove_child(self) hand.add_child(self) transform = Transform() @@ -23,10 +23,11 @@ func _on_released(): if !_grabbed: return var t = global_transform - set_mode(RigidBody.MODE_RIGID) get_parent().remove_child(self) _parent.add_child(self) global_transform = t + mode = RigidBody.MODE_RIGID + _grabbed = false print("%s Released" % name) diff --git a/Spatial.tscn b/Spatial.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://Spatial.gd" type="Script" id=1] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=2] @@ -17,15 +17,6 @@ data = PoolVector3Array( 25, 0, 25, -25, 0, 25, 25, 0, -25, -25, 0, 25, -25, 0, radius = 0.5 height = 1.0 -[sub_resource type="SpatialMaterial" id=6] -albedo_color = Color( 0.831373, 0.0666667, 0.0666667, 1 ) - -[sub_resource type="CylinderMesh" id=7] -material = SubResource( 6 ) -top_radius = 0.4 -bottom_radius = 0.4 -height = 0.8 - [sub_resource type="CylinderMesh" id=5] top_radius = 0.5 bottom_radius = 0.5 @@ -53,10 +44,6 @@ script = ExtResource( 3 ) [node name="CollisionShape" type="CollisionShape" parent="Grabbable"] shape = SubResource( 4 ) -[node name="MeshInstance" type="MeshInstance" parent="Grabbable/CollisionShape"] -mesh = SubResource( 7 ) -material/0 = null - [node name="Cone" type="MeshInstance" parent="Grabbable"] mesh = SubResource( 5 ) material/0 = null