From: Sander v. D. <sgv...@gm...> - 2008-02-17 17:00:42
|
Hi, On Feb 17, 2008 5:38 AM, Joschka Boedecker < jos...@am...> wrote: > > Actually, I'm thinking now the solution would be to translate all the > masses and the geometries (like in the ODE example in the Wiki) in > order to satisfy the ODE constraint of having the COM of the body at > (0,0,0), then assign the composite mass to the body, but then place > the body at the position we intended + the original COM offset > ( (0,0,-0.286) in the above example). This way, the masses and the > geometries are in the right position, only the body's origin is a > little displaced. Like Sander pointed out, in this case, we need to > adjust the joint anchors. > Yes, that was what I was thinking. I am trying to make it this way now, by adding the masses, translate the mass to the center of the body, translate the geometries and visual parts the same distance and then translate the whole body back to get it in the right position relative to the rest of the body again. All code is in place, but.. it relies on the masses being set before the the geometries and meshes are added, so the final center of mass is determined and can be used to determine the final positions of the other parts. However, it seems that the colliders and transforms with the meshes are linked into the graph before the body is, no matter how they are ordered in the rsg files . I have tried to dig through the code to find out why this is and how to prevent this, but couldn't really get a lead. Do you have any ideas on this? I don't want to make an 'UpdateWholeTree' kind of method.. Cheers, Sander |