Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi Collision Detection
#2
Hi there,

Obi collision events just give you a list of all contacts during the current frame. If you store both this frame's contacts and the current frame's contacts, getting enter/exit/stay events is trivial:

- Contacts appearing in the current frame but not in the previous one are new, hence a enter event.
- Contacts appearing in the previous frame but not in the current have disappeared, hence a exit event.
- Contacts appearing in both frames continue to exist, hence a stay event.

Checking this can be done in linear time (O(n + m),where n and m are the amount of contacts in previous and current frame) using a zipper-like algorithm. This is exactly what the sample ObiContactEventDispatcher component does. You can find it at Obi/Scripts/Common/Utils/. This component will trigger an event for each enter/stay/exit, that you can subscribe to and perform any custom logic.

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