Incorrect manifolds when deserializing/recreating the World state
opera-aberglund opened this issue · 2 comments
I encountered an issue when deserializing and recreating the World
state where the result of SameTouching
in the operator==
for the AabbTreeWorld
returned false. Investigating it more, I found that the cause of the inequality was that the normalImpulse
and tangentImpulse
of the manifolds in the world copy were always 0. This was the only thing differing between the objects, as everything else (including the contacts) were equal.
Steps to Reproduce:
I used a simple test of dropping a box (with area density > 0) on a flat surface. When the box landed on the surface, the contacts were recreated correctly in the copied world, but the manifolds differed.
Thank you for reporting this.
If I understand you correctly, you're not talking about a copy from copy construction or copy assignment. You're talking about a copy in the sense that the deserialized world should be a copy.
I'm not clear that's a bug. Is your code transferring this state from source to destination? That transfer has to be done for these properties of the manifolds. Not sure there's a way around that. But at least that should be serializable and then deserializable.
I recall having to do this transfer of manifold state for my unit test code of this. See World.cpp line 4203. The code for this uses a call like SetManifold(dstWorld, dstContactID, GetManifold(srcWorld, srcContactID));
where: dstWorld
and srcWorld
are the destination and source worlds respectively, and dstContactID
and srcContactID
are the destination and source contact IDs respectively for the contacts whose Contactable
's match.
I'm not clear that's a bug. Is your code transferring this state from source to destination?
Actually it wasn't. I just assumed this would be recreated automatically. I tested now to just serialize the impulses and set them manually and it seems to work. Thanks for the help though! I'm closing this issue.