Looking for Docs on SimplexSolver and SurfaceInfoConstraints

Hi, is there any information available about how to properly use SimplexSolver with SurfaceInfoConstraints?
I’m trying to get my character to have a constraint on the floor and elements where it collides, so it affects it’s velocity but I’m having a lot of trouble understanding what SimplexSolver is doing in the background, I have no idea if I’m setting the constraints properly because the results are always random.

Does anyone know if there are docs about it, or would like to help me to start a thread for that and help other folks in the future?

Thanks in advance!

I don’t think there is at the moment. However, you can look at CharacterControllerUtilities.cs in the samples project, it shows the usage of SimplexSolver and how it interprets data. Also, you can just go ahead and ask any concrete questions you have, I’d be happy to answer.

In short, when you do a query, you get some hits. Those hits need to be converted to SurfaceConstraintInfo for solver to work on. Plane being the surface normal, Velocity being the speed of the surface (if not static) and HitPosition being the closest point. RigidBodyIndex and ColliderKey represent the body that was hit. Priority is 1 for dynamic bodies, 0 for static. Touched holds the info on whether that constraint has been solved in the last solver call. The rest is internal info.

1 Like

Thanks! This is helpful!
One more question, what does the ‘up’ argument represent in the SimplexSolver.Solve method? Is it the up vector for the collider? (In my case, a capsule).
Thanks!

1 Like

It’s a normalized vector that points upwards, usually (0,1,0) or (0,0,1), opposite from gravity. It’s used for detecting if character is sliding downwards or calculating if a slope is too steep for character to climb, for example.

1 Like