UPrimitiveComponent vs UStaticMeshComponent

I’m curious why you used UPrimitiveComponent vs UStaticMeshComponent. When I tried it on my own, I used UStaticMeshComponent and it seemed to work fine. Is it because UPrimitiveComponent is higher up the inheritance tree and thus more generally applicable?

Also, while experimenting with the code, it seemed to me that a lot of components have a separate mass attribute. So if I wanted the total mass of an actor with multiple components, I’m assuming I would iterate through all components and tally their individual masses. The current iteration of code just takes the mass of the first returned UPrimitiveComponent. Is this accurate?

Thanks in advance

Yes, it’s a virtual function first declared in UPrimitiveComponent.

The components have auto weld checked so the mass of the root component is the mass of the entire actor.


From: https://docs.unrealengine.com/en-US/Engine/Physics/PhysicsBodies/Reference/index.html

1 Like

Awesome, makes perfect sense, thank you very much.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms