I am confused why I get valid COM for some objects, and zeros for others - with “Simulate” disabled for all objects, and as far as I can see in “Details” panel, their settings are identical.
Please help - we are refining FBX import pipeline for industrial parts, and interim solution of temporarily checking “Simulate Physics” seems bit round-about … Perhaps I am missing some basic concept here?
Hi ! thanks for your answer, but I am still confused…
If “Simulate Physics” setting enables Center Of Mass computation - then why turning it OFF again in “Details” panel still returns valid coordinates - what has changed, as I am getting valid coordinates with “Simulate Physics” turned off?
In other words, is there a better way of enabling Center Of Mass for imported static meshes other than clicking “Simulate Physics” ON and then OFF again for each?
Hi Mhousse1247! thanks for your answer, but I am still confused…
If “Simulate Physics” setting enables COM computation - then why turning it OFF again in “Details” panel still returns valid result?
In other words, is there a better way of enabling Center Of Mass for imported static meshes other than clicking “Simulate Physics” ON and then OFF again for each object?
Mhousse1247 & are correct. The CoM of an object is not calculated until simulate physics is enabled. Once it is, those values are ‘saved’. Which is why the values remain even after physics is disabled.
I would like to program a more elegant solution for COM, perhaps something like Simulate=ON to allow COM calculation but setting rigid parameters to prevent motion… or doing the calculation directly …
Thanks, Mhousse1247. Unfortunately GetWorldLocation (or GetActorLocation for static mesh actor) can’t work, because our FBX import pipeline takes large batch of meshes and sets their pivots at the same spatial coordinate for easy fit/alignment of components into larger parts; From TJ’s comments (below) it appears that temporarily enabling “Simulate” pre-computes COM, still available to GetCenterOfMass even after “Simulate” is turned off… Quick and dirty but works for now!
I would like to find more elegant solution, perhaps something like Simulate=ON to allow COM calculation but setting rigid parameters to prevent motion… or doing the calculation directly … I am open to suggestion if there is an easy way in Unreal here to get SM’s physical location.
I don’t know if this can help but there is also “Get Component Bounds” or “Get Actor Bounds” it return the centre and the extent of one or a group of PrimitiveComponents
Thanks to Mhousse1247, GetComponentBounds works independent of “Simulate” settings.
I experimented a bit, and found that setting static mesh to “movable” results in correct computation of CenterOfMass without having to enable “Simulate Physics” … but GetComponentBounds (or GetActorBounds) is cleanest!
Again, thanks for awesome hands-on response, Mhousse1247, you rule!!!