I am experimenting with balancing and moving multiped robots. In some solutions to such problems one reads the contact force between each leg and the ground. For example a quadroped lifting one leg while the other legs are resting on the ground, the balancing algorithm should take into account how much of the weight each of the legs on the gound are carrying. This is usually done through the normal force of the contact point/points between each leg and the ground. But I find no such parameter exposed through the PhysX api in Unity.
Am I missing something or is that function not exposed in the Unity Implementation of PhysX?
Unfortunately, it isn’t exposed. You have to request PhysX to give you contact force data through a special flag, and presumably Unity didn’t think it was important enough to expose.
That’s not an all too bad idea, Ben. You just introduced an alternative way of comparing the forces between each leg and the ground. Lifting the legs (or trying to) with eaqual forces applied and se what leg lifts first - or maybe even reading other parameters like the shift of center of mass for the whole robot when trying to lift the legs - and som on. Very good input - much appreciated.
I have been working on a vehicle suspension system and I found the same blockage: How to get the normal force on the wheels. I found two ways to work around this:
By coding my own spring and using the force it applies as the normal force.
Not using rigid bodies for the wheels but instead calculating their position inside a script, using a raycast to detect the ground distance and calculating the force needed to get them to the surface in the duration of one frame( ((distanceUnderGround / Time.deltaTime * 2) / Time.deltaTime) *wheelMass), resulting in (I think) the normal force.
My solutions are probably not the more accurate but since I saw this problem in multiple forums with no answer I decided to at least try to put my grain of salt.!