+1 vote

Is it possible to add/edit a joint (GrooveJoint2D probably suits it the best) between two objects when the game is already running? I mean between two bodies that are not colliding at the moment, some kind of stretchy line between them?

in Engine by (20 points)

You can edit a GrooveJoint2D at runtime. Access the mesh though its node name or through an instance. For example:

# The node in question
if someone_was_hit:
    # Someone was hit hard. Change the length of the joint to show how hard they were hit.
    $GroovyJoint.length = 100.0

Hope this helps.

When I try to connect two nodes with the GrooveJoint I get the following error and the connection just doesn't happen for some reason:

 E 0:00:05.322   k_tensor: Condition "determinant == 0.0" is true.  
 <C++ Source>  servers/physics_2d/joints_2d_sw.cpp:249 @ k_tensor()

Some more information:
Im trying to connect a Kinematic Body to a Static body

Since joints (like Joint2D and GrooveJoint2D) have properties, they should be accessible through code, and can therefore be changed as at runtime. Maybe I'm mistaken? :-/

It looks like for some reason they don't want to connect at all because of this error I posted above

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.