From: Markus R. <rol...@un...> - 2008-02-18 10:51:13
|
Hi all, Sander van Dijk wrote: [...] > 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 . how did you test that? The RubySceneImporter (rsg) importer creates the nodes in the top down order as they are defined, i.e. the creation of nodes is not deferred or ordered in any way. The current design of the scene graph however requires that the body node is linked in before any dependent geom node. Please see the dGeomSetBody call in Collider::Onlink() method that looks for a body below the colliders parent node. So bodies need to be linked in before the geoms in order to work correctly. > 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. I think a variant of 'UpdateWholeTree' is needed. However it should be limited to the set of the bodies that were actually created by the importer. The COM of already existing nodes should not be modified. One possibility is that an importer keeps track of the set of created body nodes and updates their COM after the scene is constructed. The calculation of the mass center should the then become part of the PhysicsServer class so its accessible from all importer classes. Another possibility is to add a member flag to each body node and update the COM on the first call to Body::PrePhysicsUpdateInternal(). cheers, Markus |