UnityMesh GeometryFilter and collisions not working correctly when scaling

Geometry Filter with Unity Meshes are not using the local scale. It just use the mesh like if the object was scaled by 1,1,1 in global space, ignoring the real scale in global space (null parent). I’m gonna work on it, I’ll update you.

Hi. I have some news. I have been working on UnityMeshes scaling on rigids. I have managed to say to iMSTK the correct scale. The problem now is the next one:

I’m testing iMSTK behaviour setting in my UnityObject scale the iMSTK rigid scale values, on the Update() function. This means that the Unity GameObject will show the scale that iMSTK is using. At the beggining all is working, but collisions make the object come back (in a weird way) to the “identity” (1,1,1) scale… Vídeo:

I suppose it’s because I’m just saying the actual scale, and not the initial one, but I think I can’t do that from Unity, because the Rigid class is using Imstk.PbdBody and Imstk.PbdModel. (I could be wrong). I will update you, as always!

Okay, I just saw this,sorry.
https://gitlab.kitware.com/iMSTK/imstk-unity/-/commit/8d6e2bfdf2af344de38b8f150899d08fb120be76

Edit: Working. The fix in this commit is the same code I was writing. :ok_hand:. There is inly one more problem, this is only working (at least for me) for objects with null parent. The fix is setting the “setParent(gameobject, boolean)” boolean to true

I’m curious, what’s the use case for scaling a rigid object during runtime ? While we do want to object to be scaled correctly at start, in general you want to be careful with scale as it should affect the mass and the inertia tensor as well. Internally we are not calculating mass or the intertia tensor from the mesh. So for a scaled object to behave correctly you’d have to change those values as well and i am not sure we support that. In this respect imstk is a physics engine that isn’t necessarily -game- oriented

Yea and also as you’ve seen the pattern is similar to the deformable, move the object into world space (via reparenting) to clear out transform values that you have applied to the mesh

I was not scaling objects during runtime. iMSTK-Unity was doing it when a rigid with different scale than 1,1,1 is added to the scene. In the video I sent, the scale was 3,3,3 in the scene, before play mode, and iMSTK was scaling my object to 1,1,1 in the first collision in runtime.
Now it’s fixed with your commit that I mentioned and the line I wrote in my last message.