Get/Set Center of Mass

Hi guys,

I’ve already posted this question in Unreal Answers but in Blueprints category.

I’m looking for the way how we can get a location of Center of Mass of object. As of now, engine seams to calculate center of mass, most probably from collision mesh. I don’t know how exactly it’s done, aka which algorithm is used, but the end result doesn’t seam to be intuitive (approximate location is a red sphere in attached image). For bodies with uniform density, center of mass should be around center of the volume of the mesh, this doesn’t seam to be a case. I guess, some other reasoning is used behind the algorithm. It’s definitely not a model’s origin, regardless if custom or generate collision mesh are used. We can offset Center of Mass, but there isn’t mush use to it if you don’t know where is it to begin with, as you don’t know by how much exactly it has to be offset. For the model on screenshot, which is symmetrical over X axis, it’s even shifted somewhere on Y axis…
Worst of all, I don’t see how it can be obtained in BPs. You can find its approximate location only by debugging the model with some off center applied forces and looking at the resulting angular velocity, which makes it very tedious to setup your force vectors such that they aligned properly. What makes it even worse is for example case when you want to build a computer assisted controls of physics based object, like spaceship or airplane. Part of the assist is calculation of forces which we need to apply from the approximate value of torque which would pitch/roll/yaw our craft in a desired direction by desired amount. Unfortunately I don’t see an easy way how it can be done if I don’t know the Center of Mass.

Did someone stumbled upon how Center of Mass can be at least retrieved? Setting it is an another story. I’m not sure what is the reasoning behind hiding this value, I guess it was simply missed.

1 Like