Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial?
#19
(21-09-2020, 07:02 PM)Havie Wrote: Okay i got this :
https://i.imgur.com/fLyaind.png

Also this is being called constantly even when nothing is happening in the scene because its touching the terrain(floor). I can't imagine this being performative when this script is on multiple objects all wanting to know when they've been collided with. Surely theres some other solution you have to recreate the collision system such as OnCollisionEnter() ? Or is this not a big performance hit as Unitys collision system already did this?

Internally, all physics engines have to deal with a list of contacts every frame, as contacts need to be solved in order for the simulation to work. In fact, the contacts list is iterated several times per frame to solve the system. Unity does this, and Obi does this, all physics engines in existence do this: they build a list of contacts, then solve the contact equation system by iterating trough all contacts at least once.

So iterating trough all contacts one last time to filter or post process the contacts is no big deal, if done correctly.

Internally, Unity performs boolean list operations to determine when to call OnCollisionEnter/Exit/Stay for different objects. In Obi, this is up to you. Of course, you could iterate over the list of contacts in parallel using jobs instead of a naive for loop in plain C#, and that would be much faster.

Quote:I can't imagine this being performative when this script is on multiple objects all wanting to know when they've been collided with.

This would of course result in terrible performance. You should iterate trough all contacts just once, and extract the information you need for different objects. Iterating trough all contacts once per object is a really bad idea.
Reply


Messages In This Thread
Tutorial? - by Havie - 13-09-2020, 10:24 PM
RE: Tutorial? - by josemendez - 14-09-2020, 08:06 AM
RE: Tutorial? - by Havie - 16-09-2020, 09:00 PM
RE: Tutorial? - by josemendez - 16-09-2020, 10:18 PM
RE: Tutorial? - by Havie - 17-09-2020, 08:10 PM
RE: Tutorial? - by josemendez - 18-09-2020, 07:01 AM
RE: Tutorial? - by Havie - 18-09-2020, 12:14 AM
RE: Tutorial? - by josemendez - 18-09-2020, 07:10 AM
RE: Tutorial? - by Havie - 18-09-2020, 09:12 PM
RE: Tutorial? - by josemendez - 18-09-2020, 09:44 PM
RE: Tutorial? - by Havie - 19-09-2020, 04:24 PM
RE: Tutorial? - by josemendez - 19-09-2020, 05:32 PM
RE: Tutorial? - by Havie - 19-09-2020, 10:41 PM
RE: Tutorial? - by josemendez - 20-09-2020, 12:57 AM
RE: Tutorial? - by Havie - 20-09-2020, 01:21 PM
RE: Tutorial? - by Havie - 20-09-2020, 04:18 PM
RE: Tutorial? - by josemendez - 20-09-2020, 07:20 PM
RE: Tutorial? - by Havie - 21-09-2020, 07:02 PM
RE: Tutorial? - by josemendez - 21-09-2020, 08:03 PM
RE: Tutorial? - by josemendez - 22-09-2020, 02:21 PM