dMassSetTrimesh uses wrong triangle transform

Issue #5 new
Daniel K. O. created an issue

The moment of inertia for a geom should be calculated on the basis of its local center of reference and not of the center of the world. dMassSetTrimesh brought us weird simulation behaviour when simply adding and removing Geoms of a Body while at different world positions (which was the only difference between those geoms) when calculating the moment of inertia. I believe the reason is that dMassSetTrimesh uses FetchTriangleCount which calls dGeomGetPosition and dGeomGetRotation which means that world transform is used because the position of its attached body gets added to the result. I was able to fix the wrong behaviour by using dGeomGetOffsetPosition and dGeomGetOffsetRotation in FetchTriangleCount.

(submitted by wITTus)

Comments (3)

  1. Former user Account Deleted

    Hi Daniel,

    Why using FetchTransformedTriangle() in the first place? If the computation is to be done in the TriMesh local frame, like it is done for the other geometries, I would expect a call to the (non existing) FetchTriangle() function (it would fetch a triangle in local coordinates, #ifdefing OPCODE and GIMPACT).

    Best regards, Luc.

  2. Daniel K. O. reporter

    For the record, this patch was imported from the sourceforge tracker. I agree with your reasoning, the patch doesn't look good. I'll leave the issue open nevertheless until it's fixed.

  3. Log in to comment