Facepunch / sbox-issues

180 stars 12 forks source link

Add equivalent for Unity's `Physics.ComputePenetration` #7498

Open dotryen opened 1 week ago

dotryen commented 1 week ago

What can't you do?

Physics.ComputePenetration in Unity would let you check if two shapes overlap and pass you the direction and smallest distance to stop overlapping. I used it in my Unity projects to make sure the player stays unstuck.

How would you like it to work?

I don't know exactly, but I just need the minimum separation to stop overlapping between two bodies. Unity did it by passing in two colliders along with their positions and rotations. It returned a boolean depending if the bodies are actually overlapping, while passing the separation distance and direction as out parameters.

What have you tried?

I have not tried anything much, I've looked through the API docs for anything similar and couldn't find anything. I don't think traces would work either because they would simply start solid.

Additional context

No response