- Home /
Reading normal force between colliders
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?
Many thanks in advance ///JmD
Answer by sneftel · Aug 04, 2011 at 01:19 PM
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.
I was afraid of that. Ben 12 - I thank you for your answer and throws out a follow up question;
Can anyone think of an alternative method to get roughly the same result - for examble reading the sum of forces currently being applied to the HingeJoint closest to the ground or something similar? $$anonymous$$aybe that information isn't available either?
Regards ///JmD
I guess you could apply a force at each contact point and increase them until the contact is broken. That's a little silly, though.
Answer by JmD_2 · Aug 04, 2011 at 03:29 PM
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.
Regards ///JmD
Answer by GalanLefont · Nov 24, 2021 at 10:56 PM
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.!
//EJGL
Your answer
Follow this Question
Related Questions
add torque at position 2 Answers
How to stop stretch armstrong? 4 Answers
contacts.normal question 1 Answer
physx joint clutch 0 Answers