Depth of an object

So, I want to make a dynamic parkour system:
How it works: a ray starts from the player collider to the obstacle.
The problem is that I don’t know how to give the feedback that the length of the player to the other side of the obstacle is for ex: Dis.
Basically ,if the length is too big, jump on it, else jump over it.

All the obstacle are rectangular parallelepiped, the line being the distance between the center of the player to the other side of the object.

Out of your info you get the obstacle object. Then using the Renderer.bounds (Unity - Scripting API: Renderer.bounds) you can get the size (in Unity) of the obstacle. You probably know the height of your player.
If I understand you correctly that should do it!

Hey, For what you’re trying to do @Tech-Labs is correct in their approach. You need to use the Renderer.bounds to find the closest and furthermost bound of where your rays hit point is, then calculate the distance between them - That should give you the depth distance of the object.

The only caviate with this is that you’d need to take into account the direction that the ray is hitting and use math to calculate which bound is the next one, there is an easier way of doing something like this which is what most games (similar to yours) would use.

player hits trigger → isPlayerInsideTrigger → hasPlayerClickedJump/VaultButton → DoVault