add follow_node

This commit is contained in:
mightypanders 2021-06-13 12:56:33 +02:00
parent a6ab00b81e
commit 179a912f13
1 changed files with 5 additions and 4 deletions

View File

@ -24,17 +24,18 @@ func add_Guest_to_Line(parent,guest):
parentAnchor.add_child(get_a_springjoint(parent,guest)) parentAnchor.add_child(get_a_springjoint(parent,guest))
var pua = guest.get_node("PickUpArea") var pua = guest.get_node("PickUpArea")
pua.monitorable = false pua.monitorable = false
guest.follow_node = parentAnchor
#springJoint.rotation = -rotation #springJoint.rotation = -rotation
return guest return guest
func get_a_springjoint(parent,child): func get_a_springjoint(parent,child):
var springJoint = DampedSpringJoint2D.new() var springJoint = DampedSpringJoint2D.new()
#springJoint.rotation+=get_angle_to(guest.global_position) #springJoint.rotation+=get_angle_to(guest.global_position)
springJoint.length = 5 springJoint.set_length(1)
springJoint.rest_length = 5 springJoint.set_rest_length(0)
springJoint.stiffness = 64 springJoint.stiffness = 100
springJoint.damping = 1.0 springJoint.damping = 1.0
springJoint.disable_collision =true springJoint.disable_collision = true
springJoint.node_a =parent.get_path() springJoint.node_a =parent.get_path()
springJoint.node_b =child.get_path() springJoint.node_b =child.get_path()