I'm trying to work out the best way of finding out the total amount of force that a body has been subjected to during a single simulation step.
What I want to do with that info is cause the body to break or explode if it passes a certain amount.
Is there an easy or correct way of doing this using bullet?
Many thanks!
Cumulative forces on a body in one simulation step
-
- Posts: 3
- Joined: Thu Aug 09, 2012 10:11 pm
-
- Posts: 8
- Joined: Thu Aug 09, 2012 3:58 pm
Re: Cumulative forces on a body in one simulation step
If you knew its speed before and after the simulation step you could extrapolate the force vector.
-
- Posts: 3
- Joined: Thu Aug 09, 2012 10:11 pm
Re: Cumulative forces on a body in one simulation step
This is an interesting idea and could be used in some cases like an grenade being thrown, using any significant change in velocity to indicate it has hit something.dunmatt wrote:If you knew its speed before and after the simulation step you could extrapolate the force vector.
However, it could be the case that an explosive/breakable body is in amongst a number of other bodies some possibly static, and gets squashed, the overall force placed on the body would be enough to trigger it, but there wouldn't be an overall change in speed (at least not a significant one).
-
- Posts: 8
- Joined: Thu Aug 09, 2012 3:58 pm
Re: Cumulative forces on a body in one simulation step
Ah, I see what you mean. I don't know anything for sure (I'm brand new to bullet), but that sort of question seems like it would be very hard to extract from bullet. Ordinarily to predict the motion of something you only need to know the net force , rather than the sum of the magnitudes of each force, so I doubt that the sum of magnitudes is ever calculated (let alone exposed in the API).
-
- Posts: 3
- Joined: Thu Aug 09, 2012 10:11 pm
Re: Cumulative forces on a body in one simulation step
Yeah, I'm new to bullet too, its a fairly steep learning curve!dunmatt wrote:Ah, I see what you mean. I don't know anything for sure (I'm brand new to bullet), but that sort of question seems like it would be very hard to extract from bullet. Ordinarily to predict the motion of something you only need to know the net force , rather than the sum of the magnitudes of each force, so I doubt that the sum of magnitudes is ever calculated (let alone exposed in the API).
I'm sure it must be possible to get the information somehow, I'm investigating whats available in the substep callback, maybe I can do something there myself.
Your idea of checking for a velocity change works like a dream for doing grenade type effects, got that working very easily, so thanks for that!
-
- Posts: 8
- Joined: Thu Aug 09, 2012 3:58 pm
Re: Cumulative forces on a body in one simulation step
Don't thank me, it was my boy Newton's idea 
