How to set/ offset the center of mass on a vehicle.

I have a tractor with a roof on it which needs to collide but it takes the average of the collision shapes and raises the center of mass much higher than I want it. I have it in a exaggerated way right now to better see changes. I’ve tried changing the Center of Mass Offset in the PHAT menu while selecting the root joint that has the bodies.

I tried using set center of mass, it seems to be changing it according to the print string but the icon never changes, and using it on the actual vehicle pawn is fairly disastrous physics wise.

Thanks,



It looks like you’re adding +50 on the z axis to the center of gravity when setting it, which will raise the center of mass. I’m assuming you want the center of mass to be lower, which means you should be subtracting, not adding.

You can also get the center of mass again after setting it, and should probably output that into your print string command instead of leaving it at the default “hello.” Using the print string to display values as they are changed is most likely a better method for you to use in seeing if things are updating accordingly.

Also, I’m not 100% sure but if I recall correctly there is a built-in center of mass offset specifically for Epic’s implementation of a vehicle class. I do know center of mass offset works correctly with physics objects from rolling my own raycast-based suspension vehicle class. Setting it in the negative direction very far was basically hilarious driving-god mode where it would rotate to correct itself even when completely flipped over.

Thanks for the reply.

Ya my current setup was just thrown together to see if it was working. I raised the boxes higher than needed and I just spam the “P” button so i get the center of mass before and after that way.
The problem is I could never see the COM locator moving at all in the viewport. Should i see it moving with this setup?

I may have missed it in the menu under the expanded details…:(…found this image.** (This image is old see below)**

I’m at work will check when i go home.

Yeah, I would use the built in COMOffset if I were you. Changing a center of mass on a model/mesh is really for if it’s a simple enabled physics model. I wouldn’t be so surprised if Epic’s built-in vehicle class completely negates/ignores the center of value functions you were using to change it, so there would be no conflicts with the vehicle simulated-physics of their class. While I think cars are also integrated with PhysX to a degree, they kind of should be treated as their own unique thing due to how the wheels, torque, and suspension are simulated by the class which is behavior not built into a default free physics object. E.G. if you just attached models of wheels to a box using physX constraints, it may somewhat roll but certainly not handle like you would expect in the real-world, which is why PhysX itself has its own specific implementations of wheel behavior that Epic’s Vehicle Class uses.

A lot of arcade games with vehicles don’t even use “precise” wheel simulations, and just raycast down where each wheel’s suspension would be to figure out where to place the wheel model and how much force to apply in the opposite direction based on raycast length in order to keep the vehicles main chassis/simple physics body upright (technically hovering if you paid no attention to the illusion of the placement of the wheel model). Although Epic’s Vehicle class aims towards realistically-simulated physics, so if you can get that to handle how you want it to behave and it doesn’t require anything fancy like being able to dynamically place wheels in-game like in Kerbal Space Program, I’d probably stick with it.

A possible method for debugging your center of mass if it’s indeed not debugging, is just adding a debug component like the EnviroIcon thing, have it not hidden ingame, and just do a set world location of component to center of mass in the tick. Again, because vehicles are a class of their own, I’d recommend seeing if the vehicle class has a different node/function for getting the center of mass from the vehicle class instead of the generic get center of mass from mesh.

Best of luck!

Deathstick,

Thanks for the advice I think i figured it out.

I couldn’t believe I missed the COMoffset in the Vehicle Movement, but I won’t be the only one. Apparently it was removed a while ago. 4.13 is the oldest i have installed and it’s not present there. It needs to be changed on the mesh COM offset instead.

I originally started this project back in 4.02,(a while ago)… but dusted it back off recently. I have been doing a good bit of other projects since then and am fairly experienced with art pipelines and blueprints,(no code). I’ve been trying to follow whats happening with vehicles since then.
Do you have much experience with dealing with Kinematic Collisions? I can get the bucket working to pick stuff up and interacting with movable static meshes but they don’t collide with non movable static meshes. I didn’t know if i would have to do something with constraints or traces.

Thanks,

Changing center of mass dont do anything, why ?