I needed that confirmation as permission to do it - you don’t know until you try!
and try I did.
(just pretend for now that the character would fill up the size of that red box)
Here’s with debugging hull expanded visuals enabled.
It did take some trial and error though. I cut a lot of unused bits of code out from the CollisionModule to make it easier to work on. The unexpected twist was figuring out how the pattern for returning hulls from terrain cells was different from returning hulls from instances in workspace. I had to modify TerrainModule:FetchCell() to include expansionSize (aka playerSize) in its parameters.
For a short explanation, the hulls for instances, meshparts, and terrain exist in a spatial partitioning grid (implemented as a hash map). Instances and meshparts have a condition where they might exist in multiple cells of the grid and would be cached in the fatGrid
. Depending on the position that :Sweep
is called, the CollisionModule finds the appropriate cell and returns all hulls within that cell. From there, its as simple as multiplying the points of each hull by an expansionSize (Vector3 * number) and caching it.
Instances:
MeshParts:
Terrain:
For networking, I had to change the :SendCollisionData() parameters to include playerSize as well instantiate CharacterData with it. Big shoutout to @CCTVStudios for the mini-tutorial on how to work with the CharacterData module.
Most of the time was spent understanding what was really going on (as well as restoring code I shouldn’t have deleted ). It looks simple but there’s a lot going on that Chickynoid already handles.
That’s as far as I got today. I’ll return to this in a few days when I get the time. I still have to implement a way to update playerSize and clean up unused memory.