0 votes

Hi,

have bind 2 rigid bodies however I can not detach them:

func fly_the_kite(player):
    holder = player
    if flied_the_kite:
#       leave_follow_me()
        print("nomore")
        flied_the_kite = false
        PhysicsServer.free_rid(self.get_rid())
#       PhysicsServer.hinge_joint_set_flag(get_parent().get_node(str(player)).get_rid(), PhysicsServer.HINGE_JOINT_FLAG_USE_LIMIT, false)
#       PhysicsServer.joint_create_hinge(get_parent().get_node(str(player)).get_rid(), get_parent().get_node(str(player)).transform, self.get_rid(), get_parent().get_node(str(player)).transform)
        Global_batch.carried_object_items.erase(self.name)
        return
    else:
        flied_the_kite = true
        print("nomore2")
        PhysicsServer.joint_create_hinge(get_parent().get_node(str(player)).get_rid(), get_parent().get_node(str(player)).transform, self.get_rid(), get_parent().get_node(str(player)).transform)
#       follow()
        Global_batch.carried_object_items[SAVE_KEY] = self
        return
in Engine by (193 points)

1 Answer

0 votes

I have found that we don't need a PhysicsServer. method. The best way:

func newhinge():
    var newone_hinge = HingeBody.new()
    newone_hinge.node/node1 = Whateverrigidbody1
    newone_hinge.node/node1 = Whateverrigidbody2
by (193 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.