Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi Collision Detection
#20
(21-01-2021, 04:17 PM)meryemekinci Wrote: Hi Jose,

I am using the OnEnter, OnExit methods to understand collisions in my project right now. But I am having another challenge. (You can see a video of gameplay from the game in the previous replies (#13), if it's not visible, I can send another one.)

The issue is that when I roll the rope around two joints once and I try to roll around already-contacting joint again, OnEnter is not going to be called. But since the length of the rope is expected to be changed according to number of contacting joints, this problem makes my calculation not work properly. 

How can I know that the rope contacts with an already-contacting joint?

Thank you in advance.

Hi there,

You can't use the OnEnter event for this, because it will only be triggered the first time a collider touches the rope. Enter/Exit/Stay behave the same way as Unity's contact events.

You will need to use the raw collision callbacks (http://obi.virtualmethodstudio.com/tutor...sions.html). Keep track of a list of all colliders in contact with the rope, in chronological order. When you detect a new collision with a collider already in the list (that is, same collider index, but different particle index), check if it's the last one or not. If it's the last one, the rope is still wrapping around the same collider. If it's not, it means the rope is wrapped around a different collider, but has returned to wrap around a collider it was already in contact with. To clarify:

Case 1: current collider list is A, B, C, D, a new contact with collider D has been detected. The rope is still wrapping around D. Nothing to do.
Case 2: current collider list is A, B, C, D, a new contact with collider B has been detected. The rope is wrapping around B a second time, add B to the list (so it becomes A, B, C, D, B).

This is the first idea that comes to mind, there might be other ways to do it. hope this helps. cheers!
Reply


Messages In This Thread
Obi Collision Detection - by meryemekinci - 21-12-2020, 02:27 PM
RE: Obi Collision Detection - by josemendez - 21-12-2020, 02:53 PM
RE: Obi Collision Detection - by meryemekinci - 21-12-2020, 03:10 PM
RE: Obi Collision Detection - by josemendez - 21-12-2020, 03:14 PM
RE: Obi Collision Detection - by meryemekinci - 21-12-2020, 03:18 PM
RE: Obi Collision Detection - by meryemekinci - 23-12-2020, 12:20 PM
RE: Obi Collision Detection - by josemendez - 23-12-2020, 12:37 PM
RE: Obi Collision Detection - by meryemekinci - 23-12-2020, 01:39 PM
RE: Obi Collision Detection - by meryemekinci - 24-12-2020, 01:42 PM
RE: Obi Collision Detection - by josemendez - 24-12-2020, 01:44 PM
RE: Obi Collision Detection - by meryemekinci - 25-12-2020, 11:33 AM
RE: Obi Collision Detection - by josemendez - 26-12-2020, 09:19 PM
RE: Obi Collision Detection - by meryemekinci - 06-01-2021, 06:01 PM
RE: Obi Collision Detection - by meryemekinci - 21-01-2021, 04:17 PM
RE: Obi Collision Detection - by josemendez - 22-01-2021, 09:27 AM
RE: Obi Collision Detection - by meryemekinci - 08-01-2021, 08:46 AM
RE: Obi Collision Detection - by josemendez - 08-01-2021, 10:47 AM
RE: Obi Collision Detection - by meryemekinci - 08-01-2021, 12:17 PM
RE: Obi Collision Detection - by josemendez - 08-01-2021, 12:26 PM
RE: Obi Collision Detection - by meryemekinci - 20-01-2021, 09:44 AM
RE: Obi Collision Detection - by meryemekinci - 23-01-2021, 10:39 AM