Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Extending Grappling Hook & Collision Detection
#3
Hi!

In your collision callback code you’re not using the contact point at all (contact.pointB) - instead you assume the particle’s current position is the contact point, whatever it may be. This generally won’t be true since collision detection happens during physics (at a fixed timestep) but the rope is extending every frame.

Use contact.pointB as the attachment point, keep in mind it’s expressed in the solver’s local space. See:
https://obi.virtualmethodstudio.com/manu...sions.html

Also keep in mind you will have to deal with tunneling: setting the position of particles directly while extending the rope means they have zero velocity so CCD won’t work: they will pass right through objects if moving fast enough. This is why we use raycasts in the example scene instead of relying on static collision detection.

Assuming the example approach won’t work for you (as it raycasts just once before shooting the rope, so any objects moving in the way of the rope as it extends will be ignored) a much simpler approach imho that doesn’t have either of the above problems and is more efficient is to raycast from the tip of the rope during the previous frame to the tip of the rope in the current frame as it extends. This doesn’t require iterating through all contacts to find the one you’re interested in, and won’t suffer from tunneling since you cover the distance moved each frame.

Kind regards,
Reply


Messages In This Thread
RE: Extending Grappling Hook & Collision Detection - by josemendez - 13-05-2026, 07:13 AM