Force of a contact?

Hello, i have no time to look into jME and the Physic-System, but i am observing this forum and the progress of jME daily and tonight, as i thought about my game idea, i came to the following question: when a ship flies against a wall, is there a way to calculate the force with which the contact happens?



If not, then this is something i would love to see in the jME Physic-System, because it would make a damange-calculation very easy and this would be great :smiley:



Thank you for your efforts!

Yup, this is something that is very easy to do:



Vector3f totalForce = somePhysicsObject.getForce();



This is the total force on the body at this time of calling. So after a collision call that method and it will tell you the force in terms of direction.
Normlise that and you will obtain the direction of the force.

For damage calculation. This is very easy. Obtain the force BEFORE impact, obtain the force AFTER impact, subtract one away from another. And find the distance ( i believe this would be the force? ) and that would be the force...That number depends on the mass, velocity, initial force before contact and really, its hard to do accurate approximations of damage from this only.

A better way to do it is to obtain the "velocity" rather than the force:


Vector3f velocity = somePhysicsObject.getLinearVelocity();
float speed = velocity.distance(velocity);



and do calculations based on that velocity.

Hope that answeres your question

DP

…yes it does. Thank you :slight_smile: !