I have a entities with physicsColliders (simple capsules), and I need to figure out if they are currently on the ground or not.
Currently I've tried 2 approaches in the hopes of getting one that can run efficiently.
-
Have a job that on every run, casts a sphere collider down by the character's feet and iterates through all the entities that overlap to find if that array is larger than 1 (min of array 1 because this collider will interact with the current character, which we want to ignore)
-
Have a job that on every run, sets an enableableComponent for "isGrounded" to false - then turn on collider events for all character physicsColliders - and use the CollisionEventsJob to then watch for collisions and set those entities to have an IsGrounded value of true.
#2 is faster - but I've only tested it for about 50 entities before it starts bringing my system down to about 10fps.
What else do you guys do for efficient ground checks?