I’m fiddling with some custom calculation of friction force. Right now it is related to velocity of an object, but a better way to implement requires knowing the total force which is applied to an object. Is it even technically possible to query current total force on a component?
Did you ever figure this out?
What problem are you trying to solve?
No. I thought that there is some sort of stack where forces from AddForce, AddImpulse are accumulated and then applied on physics update. But from what I understood, they are applied one by one during physics update. They are not accumulated, but simply called later.
The problem I’m trying to solve is a custom friction. Right now my calculations are done on a basis of rigid body velocity, which is technically velocity from previous frame. So the friction force that I calculate is practically relevant only to the previous frame, not to a current one. To calculate it properly, I need to know rigid body’s future velocity (after current frame) which is not possible to do if you don’t know which forces will be applied to it.
Not a problem per say, Just looking into getting a per actor time dilation by fudging there physics.
The other option is to delve into the source and add some kind of accumulator or something.
This seems like it would be very useful. Despite the delay, I’ve placed a feature request in for this function to be added for both C++ and Blueprints usage. I’ll be sure to let you know if it gets added but it may be a while as it is a new request.
Have a nice day!
Thank you, Matthew! This will help greatly in other cases than friction too. Like building a control system for space craft, “smarter” suspension for vehicles, knowing how many G vehicle or driver experiences.
Can we not mathematically work this out? Force = Mass * Acceleration… Can you not work this out using the mass of the object in kg, and the change in velocity of an object using math nodes?
That’s what I do right now. The problem is that this is “reactive” behavior, meaning you will produce force only after the fact that movement occurred. This way you can’t produce force to counteract force at the moment when it will be applied.
Ah! Thanks for the clarification
Unfortunately, the feature request has been denied. The reason is that PhysX actually doesn’t expose the Force for us to use. This would need to be a change made by Nvidia themselves to expose the force if we wished to create a function such as this. You may be able to change your PhysX locally to expose this but it’s not something we’ll be able to add to the official builds.
Thank you for reply, Matthew!
Sad to hear that but it is what it is. I’ll look into how it can be exposed from the PhysX code. Cheers!
Did anything change since then on Nvidia’s side?
Nothing has changed in accordance to this issue. I wouldn’t expect anything to change however.
Any change since UE have chaos? Is it possible to get this value since UE4.26-chaos+(and UE5+)? This would be really useful when for example trying to calculate exact force to stop body since the calculated way base on mass * acceleration is always slightly off and causes issues specially at low speeds.