   ODE supports stress?
  Ok, the reason for this post is a pretty simple idea of a game actually.And since I am not at all familiar with physics engines, I am not quite sure of how they usually work. However, my question is really, does ODE or any similar free physics engine support for getting stress from bodies? (Like in Pontifex where bridges show stress on each beam (and brake when overloaded))Or does this require special or custom made libraries?   
  no. you may be able to implement something similar with a rigid spring or something but it would be cumbersome to program.   ;  Vidalsasoon's not quite right in this instance. You can make bridges, and break them into pieces with force, but it requires a little work on your part. What you need to do is destroy the joints that hold the bridge together when the stress on those joints exceeds some value. I remember making humanoid things with detachable limbs, which was quite amusing when one of them decided to explode, blowing another one away (literally). Unfortunately I haven't played with ODE in a long time, and I can't find any of my old code, but I had only just recently started playing with ODE when I had it working, so it shouldn't be too hard.   ;  well are we talking about bending/breaking joints or bending primitives?from the OP, i had the impression he wanted to change the shape of a primitive (or see the stress on it). The ODE API does not support this.Like I said, since a bridge does not usually have joints you could fake it by adding joints to the bridge and seeing it bend with stress but it would be inaccurate and cumbersome to code.   ;  Thanks for the answers!Sorry for being a little unclear...Uhm, what I meant was a little of both to be honest, but I thought they came hand in hand, that is, knowing stress you can brake stuff that exceeds a threshold, or the other way around, if something breaks it should mean that you should be able to figure out the stress?Or is it that I am perhaps mixing terms up?But if I understand you correctly, then without major work from my side this is not possible? (That is, getting stress on primitives (knowing this also of course allows me to break them))So, to formulate the question as simple possible for those who have played pontifex, would it be possible to create a pontifex clone using ODE? (E.g. simulating similar physics interaction as in the game)Regards   ;  Getting the 'stress' on a primitive is not the same as breaking it. Breaking it requires making several new primitives, which can be a lot of work, especially if you want to make it realistic.So, to clarify what has already been said, you can construct a single primitive out of several primitives that are attached with joints. Joints can have a breaking point of stress, after which they will no long hold objects together. I am pretty sure that this is how programs like that bridge builder one do it.   ;  ODE does 1) support a way to get the force at any joint connection.  This means you can break the joint once the forceapplied at the joint is above your stress threshold.2) There is an expantion to ODE that comes with the distribution that takes care of this for you in the form of a breakable joint.  All you have to do is set the force you want it to break at.In both cases the thing you need to worry about is that a small timestep can cause the system to break all the joints before you want it to.This means if you need a small timestep, you will have to adjust your thresholds on the joints.   ;  With regard to the original question, in some cases with a bit of work you can compute approximate stresses from ODE.I know this reply is overkill, but I think it answers the original question as stated, and was interesting to think about.ODE is a rigid body engine, and does not explicitly model internal forces (the stresses that when integrated make up reaction forces, etc.). In fact, it doesn't really even care about what the shape or size of an object it, from a reaction-force computation point-of-view. These things are needed to compute stresses, but ODE doesn't need those. It only really uses shape to determine the inertia tensor and mass, and for collision. All forces are point forces. All moments are pure, point moments.So...to get back to my point, suppose you want to model a cantilever beam. You happen to know its cross section and material properties. You want to see what the stress is when the thing is sitting there, loaded only by gravity. And you want to see how it reacts when crates (you know, game objects...) bounce off of it.Caveat Emptor! Er.....what follows has some fuzziness. Its been a long time since I studied strength of materials. I am a bit fuzzy on the origin of torsional stress, and so this discussion kind of ignores that. Intuitively, in my mind, I have convinced myself that torsional stress is a man-made concept that makes math easier for theoretical and some computational strength of materials analysis easier, and that the reality of it is that at the infinitesimal material element level torsion is ultimately a side effect of forces.With that caveat, here's how you can do it, with ODE:1) Model the beam as a single rigid body.2) Give it whatever appropriate shape for collision and inertia computations. Ideally, this will be the actual shape, but it could be approximate. It really does not matter as long as you get the inertia tensor right and the shape is adequate for collision. You're going to use exact cross-section data for stress computations (presumably), but from an ODE point-of-view you just need the inertia tensor and collision stuff to be good. You could also specify the inertia and mass properties directly to enable using a simpler collision shape.3) Apply rigid body constraints to tie one end of the beam to a wall, allowing no translation and no rotation (it is fully constrainted).4) Run ODE for a while, let it settle. Let things bounce off, whatever. Basically, just run your sim. And do the following steps whenever you need to get stresses.5) Read back the joint force/moment applied to the body.6) Consider that joint force/moment to be the integrated stress. Well, it is!7a) Quick-and-dirty way. Take the joint force/moment, divide by area, and you have an approximation of the stress. But, this assumes the stress is constant across the cross section, which is unrealistic when the moment is nonzero. If you choose this step, you're done!7b) Assume that there is no distributed moment! This is important. The moment/torque is merely a side effect of the distributed force! So, you only need the moment so that you can find the correct stress distribution (force/area) across the cross-section!!!! (Er...re-read my Caveat Emptor above.)8) Make an assumption about the stress distribution. For example, assume the distribution is planar. (Which is reasonable for a linearized approximation, and for cross-section shapes that are small compared with the length of the object.). You'll ultimately compute 3 different planes, one for each of the x, y, and z components of force.9) Compute the planar surface that when integrated across the actual cross-section shape will give you the same joint force and torque from step 5. I'm assuming that, say, the x and y axes are in the joint plane (e.g., the wall plane where the beam is cantilevered), and that z is perpendicular to the joint plane. The x component of stress, distributed across the cross-section, contributes to the generation of moment/torque about y and z. The y component of stress contributes to moment/torque about x and z, etc. So, integration across the cross-section of the plane representing the distribution of the y component of stress PLUS integration of the plane representating the distribution of the x component of stress must equal the z component of the reaction torque out of ODE. And the integration of the x component of stress must yield the x component of reaction force. For each stress component, you have to plug the plane equation into moment/torque computations for 2 directions, and into 1 equation for the corresponding reaction force, then solve basically 9 equations simultaneously for the 3 stress component planes. That's 9 equations, and 9 unknowns for the unit normals of the stress planes. But there are also 3 unknowns for the plane offset distances. You need another 3 equations to close the system. Its easy to get the extra 3 equations. Just set the integrated x component of torque contributed by the x stress plane to be zero, the integrated y component of torque contributed by the y stress plane to be zero, etc. So, really each stress plane contributes one reaction force component and 3 reaction torque components, with the contribution to one of those torque components being exactly zero. So, that's 12 equations and 12 unknowns. (I feel like this is stated awkwardly. Does it make sense? In my mind, it is actually simpler than the explanation of how to do it. Sadly, it takes more time than I have to make a good visual to support this.)10) Now that you have a planar surface to approximate the distibution of force stresses, you can compute the total stress at any point in the cross-section just by evaluating the 3 stress planes!11) If you must have a torsional stress at a point, it can be derived using derivatives of the 3 forces at the same point, I believe.12) As I mentioned above....there may be some subtle torsional stress issues that I have not dealt with properly. I took my structural analysis classes back around 1986, :).   ;  I just spoke with a structural engineer about how to compute stresses, given point reaction force and torque + material shape and response properties. First, torque always results from force, and does not exist independently. Although the planar assumption I mentioned is appropriate in some cases, it certainly isn't correct in many cases, e.g., with exotic material cross-section shapes, composite materials, etc.If the desire is to get truly accurate stresses, it can be done given the point force/torque info from ODE + shape/material info, but the solution is trickier in general than I described. We actually produced a software product several years ago, called V-Lab, which would do just this---take input force and torque, cross-section shape, and composite material definition, and then compute the stress distribution across the cross-section.   