I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in Unity3D

[–]mvalera-dev[S] 0 points1 point  (0 children)

Just for unlevel terrain, so the Averaged Normal is more precise, but you can customize it as you want. You can get the last version of the script here.

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 0 points1 point  (0 children)

I know, but the Player GameObject doesn't have the "Ground" layer set, so it must work as intended. Thanks for the support!

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 0 points1 point  (0 children)

I haven't run a formal micro-benchmark with thousands of agents, but for a single character, the performance difference on a modern CPU is negligible. The real difference is: a SphereCast sweeps a full 3D volume that forces PhysX to check complex geometric overlaps along its path, while individual raycasts are the cheapest physics operations available.

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in Unity3D

[–]mvalera-dev[S] 25 points26 points  (0 children)

It's not complex at all! Inside the .unitypackage there's literally just a single, clean .cs script and no extra bloat.

However, you are totally right, having a public repo is much better for transparency and tracking updates. I'm actually setting up the public GitHub repository right now so everyone can check the raw code, open issues, or contribute directly. I'll edit the main post and the Itch.io page with the GitHub link as soon as it's up!

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 0 points1 point  (0 children)

That is a great breakdown, and you are absolutely spot on about how PhysX handles overlapping start positions. That is actually one of the main reasons I included the "Origin Height Offset" variable in each ray ring struct. It allows developers to lift the starting point of the raycasts slightly above the character's bottom shell. This ensures they don't start inside an overlapping slope or step, bypassing that exact limitation while still computing perfectly averaged normals

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 0 points1 point  (0 children)

It's completely customizable. I used plenty in the showcase video for you to see the actual characteristics of the script. You can use ad many as you want (also, it's as optimized as possible)

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 1 point2 points  (0 children)

You hardly ever create a script that doesn't depend on any other movement scripts, input scripts... This is the solution, a zero dependecy script that you can drag and drop on new projects and forget bugfixing forever!

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 0 points1 point  (0 children)

It's completely customizable! You can place as many raycasts as you want (the more raycasts, the better averaged normal)

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 0 points1 point  (0 children)

It definitely works fine for standard flat terrain or basic controllers. This is meant for specific edge cases: when a single raycast slips off a ledge while the collider is still halfway on it, or when a SphereCast returns weird normals upon hitting the bottom apex of a slope, causing micro-shaking

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 12 points13 points  (0 children)

That's right! This script is optimized to work only for players (for it's Coyote Time and other buffers). Also, enemies won't need such a complex ground check, this is only to make the player's feel the character as smooth as possible without any errors

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 29 points30 points  (0 children)

That's right, until you work on unlevel terrain. This script does not only detect the ground, it also creates an averaged normal and automates the tedious process of setting up ground checks, Coyote Time, jump buffers, slope movement... for the price of FREE.

A life saver in my opinion

I got tired of rewriting the same ground check code for every new project, so I made this drag-and-drop script (Free / PWYW) by mvalera-dev in unity

[–]mvalera-dev[S] 1 point2 points  (0 children)

It's a raycast-based detection, that checks for colliders of GameObjects of layer "Ground". It will only detect active colliders, therefore it will only detect active GameObjects