rigid body Wrap around with attached rope (pinjoint)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gregbug

hi guys,
i’m trying to make a wrap around object (rigidbody) and followed the last example (asteroid) in this link (kids
can code)
and ok it’s works using _integrate_forces().

i added a rope as child of main object and when object wrap the rope don’t follow main object and mess all the physics and movement.

any idea/help what’s wrong?

thanks for your help.

:bust_in_silhouette: Reply From: gregbug

any help/suggestion ?

:bust_in_silhouette: Reply From: gregbug

i’m going crazy… i don’t know if is my fault (for sure) or a godot bug
i’m tryng to port to godot an old game i published some years ago using gideros… “GidHelix”

here is the video of my problem…
youtube link

if i remove the rope all work fine…

for wrap helix i used

func _integrate_forces(state: Physics2DDirectBodyState)->void:
var xform = state.get_transform()

if xform.origin.x > screen_w + helix_half_width:
	xform.origin.x = -helix_half_width

if xform.origin.x < -helix_half_width:
	xform.origin.x = screen_w + helix_half_width


it seems that attached rope don’t follow parent helix…

any ideas?

:bust_in_silhouette: Reply From: Lord of Madness

Well I am pretty sure its too late for you but if anyone else stumbles at this:
The problem is that the PinJoint2D will work even when just half of the object has passed through the screen wrap.
And since the screen wrap is just a teleporter the pinjoint will pull on it when its in the middle of the screenwrap.

I am not that experienced with godot but what I’d try is apply the teleportation on every link of the rope once and only if the main rigidbody is teleported.