Physics Problems

Hi folks,

after being able to import my model (or: my extremely simplified test-model) into UE4 from blender, I’m now having problems, again.

This time it’s physics. As a short introduction: I want to make a conveyor, consisting of a frame (represented by a simple box for testing) and rolls, which are simply cylinders.
I want the cylinders to rotate and - by doing so - transport stuff that lies on them.

As I’m coming from Unity I will give you a short example on what I would do there: I would import my FBX, which then gets imported with the hierarchy preserved. I would select a roll, give it a rigidbody with mass and a collider (capsule or mesh, that depends) and then I would add a hinge joint, constrained to the rotation axis. I would tell this joint to have it’s motor enabled and then I would - via script - apply a target velocity to it.

I imagined to have the same workflow for UE4, but I can’t get things working. Not a bit. I imported the model as a skeletal mesh, let UE4 create it as a rigid mesh and with a physics asset.

Then I opened the physics asset tool and found out, that the capsules around those rolls and the frame-box were far away from what the meshes looked like. So I replaced the box’s collider with a - well - box-collider and applied a simple convex hull collider to the rolls. I don’t care about performance at this point…

Afterwards I disabled gravity for all parts and switched to constraint mode where I changed the constrains of the rolls to “hinge” with only the “angular twist motion” set to free, enabled the angular velocity drive and disabled collision between the cylinder and the box.

Then I added a level blueprint for testing, where I tried to apply a angular velocity to the appropriate bone…didn’t do anything.

I tried to set all the angular limits to “free” just to check what happens. Well…take a look at the screenshots I provide with this post.

So: Can anyone tell me where I’m being stupid? Thanks in advance and best regards,


d4ea1076eaa0d36bcb1e40ea29a3e33b363a8e66.jpeg

Hi,

You are not being stupid :slight_smile:

The angular motors in Unity use a “Twist and Swing” mode which allows angular velocity drive while some axes of rotation are locked. In UE 4.2 the angular motors use “SLERP” mode, which has some of its own advantages, but will not work if one of the axes has been constrained.

We’ve added the ability to switch from SLERP to Twist and Swing which will resolve this problem: the change is on github and self contained if you’re compiling from source: https://github.com/EpicGames/UnrealEngine/commit/6568f9c9a63f4f6b6ea6b2deaf60091bd8084468

The change will be available in the 4.3 release. Sorry about this I know it’s not ideal.

Hope that helps

So, when I get the latest source from github this will allow me to solve this? Is there some documentation available on what pros and cons those two types of drives have?

I will get the latest source tomorrow and try again. Is there something else I have to pay attention to, or is my approach correct (besides the fact that I have a too old version of the engine) in general?

You can read more about the documentation here: https://developer.nvidia.com/sites/default/files/akamai/physx/Manual/Joints.html#drives

I think your approach is correct, please let me know if there’s any problems as motors are still something that are being improved.

So, now I got 4.3.0 but…where do I change the angular drive mode?

Do you mean the hot fix? 4.3.0 is not out yet. Once 4.3 is out (or if you get latest from github) you can change the angular drive mode in the details panel of the constraint: motor.png