Simple physics asset with 2 solid parts.

Hello! I have an asset I wish to add physics to. It’s just two parts, one that can rotate in one axis, and one attached to it that can rotate in further in the same axis.


Basically, it’s just this simple lantern. (pardon the graphics, it’s just placeholder while I’m figuring this out).

I’ve tried to follow a few tutorials but I can seem to get things to attach properly together. For the sake of following the tutorials directly, I’ve added two bones, one base bone at the ring of the lantern, and one through the lantern itself. In 3ds max this behaves as expected, everything is attached to the base bone, but I can rotate the lantern around the point it’s attached at the ring, perfect.

However upon import the asset into UE4, the hierarchy/rotation/pivot appears to be inverted? If I rotate the bones they rotate at the opposite end as in 3ds max. At any rate it shouldn’t matter too much, as it seems physics asset bodies interact independent from bones.
I believe I technically shouldn’t even need bones, since there’s no skinning and weighing involved, only a basic object hierarchy. And I managed to import the object linked together properly themselves, but I can’t quite figure out how to make them interact as expected.

Do I actually need 3 parts? I can get the ring to rotate as if it’s on a hinge, and I can get the lantern to rotate around the ring, but not both at once since they are only 2 objects with 1 constraint.
Since I want the ring to have its own rules regarding how it rotates, is it possible to have 1 object with it’s own constraints without linking it to another object, or do I need a 3rd dummy object that acts as the ring’s attachment point?

I’m also struggling the positioning of the constraints, it always wants to place position number 2 50 units above the asset in question, and if I move it 50 units down so that the objects rotate around the correct point, it also moves the lantern into my ring, instead of them staying in place. What gives?

In the PHAT asset each bone has constraints and shapes.
Give the lantern a constraint that locks everything except circular (probably 90deg) motion around the proper bone axis.

either make the handle bone Kinematic, or lock its axis all together.

​The point of the second bone is as to have a socket that can be attached to or a bone to attach to a socket rather.

To get a more realistic swing you may want 3 bones.
one, to use as socket.
one, for the ring - because rotation between the socket and the ring is pissible laterally to the ring.
One for the lantern, becuase rotation of the lantern on the ring is possible in a different direction then where the invisible bone is.

Thanks! I got something working by adding that 3rd bone. But since I use the meshes themselves as “bones”, it made the dummy bone a visible mesh as well. How would you suggest i hide it? (Though having some sort of spike it’s attached to does look more correct than a floating hinge, I might just make it a proper model.)
I’m also having problems with having more than 1 hinge. I’ve added a hinge between the attachment bone and ring, which behaves as expected.
But if I now do the same between the ring and the lantern, it behaves as a spongy ball joint no matter how I constrain it. It wasnt’ a problem between these to when I had just those parts.

I’m also still struggling with having to do some strange offsets of to the 2nd position of the hinges (as if the editor believes the object is much larger than it is, even though I reset XForm and collapsed it before import). But I’m able to work past it with some minor back and forth of just trying, so it’s not too bad.
But I suspect it’s the cause of the second hinge not behaving correctly, as with the first one, both positions are at 0,0,0.

If I try to zero both positions in, to where they should be, the lantern moves up into the ring.

Not sure what the equivalent of Apply Transoforms is in max, but thats likely why the mesh is interpreted as being larger than it is. Then again could be a number of things.

Back to the question I can actually answer.
thats how - currently - PHAT works. If you ask me, its a poor physX implementation, but I haven’t bothered looking into it because there is a workaround.
One of the values of the asset has an X Y and Z that represent the tension allowed. Can’t recall the exact name, but there aren’t many x/y/z options on either the capsule or the bone, or the constraint.
On bodies (limbs) I usually set the value for X (the bone orientation away from the body) to 5/4/3/2 (hand, forearm, shoulder, clavicle) so that you can actually grab and drag the character by the arm without having it become a slinky…

Sounds like the equivalent of Reset XForms in max, what it does is remove all garbage transformation data so the current mesh is cleaned up and 1:1.

Hmm, I’m not completely sure what you mean, but I’ll have a look with your quote on the side while I do some experimentation and see if I can figure it out. I’ll come back to you!

Thank you. Inertia Tensor Scale is the one you want.
You need to have a few things set up for the picking up of a ragdoll.
Mostly substepping.
Max Deltta Time: 0.016667
MAX Substeps 6.

quick example:

And settings to go along, as I had it open.
FootSettings.png

Not sure what the defaults for Damping are, but all my limbs are set to .01linear, and .0 angular.

The other important settings MAY be Enable Projection and a Linear tolerance of 5 on the constraint. Those too seem to be Default values however.

Thanks to both of you for your back and forth there, you helped me get the hang of the settings and I finally got it behaving decently.

I think perhaps the reason I experienced the strange offset was that I import my assets at a 0.1 scale. I thought UE would scale all the settings accordinly, but apparently there’s some junk information that gets stuck in the scaling process.
I found out that this also made all the parts act 10 times heavier than they should, exacerbating the issues I were having a lot.

Alright, so I’ve reimported the asset at the right scale with a few more segments of rings to it in order to allow for better motion. But trying to get the constraints to work properly is absolute murder and I’m starting to develop a passionate, deepseated hatred for how it’s implemented here.

The pivot point and the offset just want to be wherever they feel like, the directions make no sense, the rotations make no sense and the center of mass is invisible and not in normal directions used anywhere else.

I can get one constraint to roughly behave through lots of trial and error, but as soon as I enable and start working on the next segment, everything is out the window and broken again.

Even if I can get each segment to behave how I want, they just refuse to be placed how I want and move inside eachother and seem to want to share the same pivot point when used together.

I just made a cloth asset work with phat for world collision, and for a change, i made it manually instead of having the bodies automatically build.

Best tip I can offer is Work Backards

Select the last bone, select the one before that, and create a constraint. Add in the collision for it, and keep on working backwards up to the kinematic bone.

By default the constraints are set to the bone’s root. that’s where they snap.
Collision too. so you always have to adjust it.

To set the limit on a constraint you hold ALT. just rotating it is only a visual aid. it should not change how the constraint actually behaves.

Yes, it is painful. BUt on 10 or less bones you can make it manually in about 10 minutes once you get used to it.
You can always make something like this:

You’ll be a pro by the second row of bones :stuck_out_tongue:

Thanks! I finally figured out why the starting point was all off in my case.

I had fix the asset (since my models are used as bones there’s quite a lot of transformation involved) in my modeling software (3ds Max).

Usually Reset XForms catches everything, but it hadn’t in this case.

First I had to realign the Pivot points of all assets to the world, and position them according to where I want them to rotate.
Then I had to reset XForms, collapse it, then reset the new collapsed asset again in the new position.

Now the object is behaving much more like expected in UE4.

Do you have any suggestions on how to keep the constraints from separating and jittering like this?

Even with quite high inertia tensor and drag settings, it keeps dropping occasionally.
I really struggle with parts moving in directions and angles that are supposed to be locked.
I only have limited movement in a single angular axis. Yet it keeps trying to rotate and move linearily before bounding back.

Yes, the tensor scale we discussed before.
You need to pick the correct axis, and increase it.

Also, consider the fact that a mouse pull applies A LOT of force - you’ll almost never be able to match the same amount of force in game. meaning that maybe the asset could already work when in play. Still, bump up the value from bottom up on the correct axis (depends on bone). and it should provide more stability.

That setting doesn’t seem to fix this specific issue in my case, it only makes it rotate slower.

Edit: I was able to fix it by making all parts much, much heavier and altering other settings to make them appear lighter instead.
Seems like things break when working with assets sub 1kg.

Odd. For my characters the minimum weight of a limb is 2.5kg and they still stretched like rubber until the tensor scale change.