For this post, I have Peter L. Newton, a game developer and VR developer, to talk about some of the issues that you might encounter when dealing with physics for Unreal Engine 4 (UE4).
What’s Up Everyone,
This is Peter L. Newton, thanks for joining me today! Welcome to an edition of Things I Wish I Knew When Starting In UE4. Because tell me how often have you had a problem resolved with a checkbox? I hope I can show you a gem of checkboxes. I also want to take this opportunity to shout out Steven for what he is doing at Bright Developers and show him how much I appreciate him allowing me to contribute. I look forward to future post! So…let’s go!
Do you Physics?
If you’re constantly in a state of working, it can sometimes be easy to forget the basics. And those like me who rely heavy on the Editor, the screen can start to blend together after a long day or just getting frustrated. I found that me and some colleagues at work where having some difficulties with getting Physics right. I also notice we kept running into a lot of the same issues, which I found others also came across.
TL;DR
So I’ve compiled a list below which highlights some of the gotcha’s with Physics behavior within Unreal Engine 4.
Mesh Components Properties (Static Mesh or Skeletal Mesh)
Mesh Component Collision must be enabled, but the Collision Response can be anything.
Check that Collision primitives (Custom Collision, etc) exist on the mesh component.
Don’t negatively scale mesh component, breaks internal collision.
Physics Properties (Getting, Setting)
Setting improper mass of objects can break collision internally.
Static Mesh Collision Complexity must be SimpleAsComplex for normal physics behavior, ComplexAsSimple allows colliding with Physics simulating actors but you cannot simulate the component.
Request For or Do Work at the appropriate time. Set Mesh before Event Begin Play on that actor, Request mass after object is in world simulating. Mass Scale works before Event Begin, Get Mass / Set Mass doesn’t.
Body Instance contains Physics Properties of Mesh Components.
Physics Behavior
Simulated Mesh Components do not have parents, only children. Use Physics Constraints as a replacement of the normal Scene Component hierarchy. Don’t rely on Set Actor Location unless the Mesh Component is the root of the Actor.
And that is it! This list isn’t exhaustive but I hope it points out some of the gotcha’s that got me during my time with Physics!
Till next time,
Peter L. Newton