Creating a physics platform that stabilizes itself

Hello. I Am trying to make a platform that rotates based on the objects/players standing on it. Currently, I am using a Static mesh with a Physics Constraint attached on it. It works well with the mouvement, but I’d like to make it so the platform always tries to stabilize itself to the origin rotation.

I have locked all linear limits and limited all angular limits. I am trying to use angular motor with a target orientation of (0,0,0) but it doesn’t seem to have any effects.

How does the angular motor work ? Is it a good way to achieve this goal ?
Should I just use blueprints to apply an angular force towards orientation (0,0,0) ? If so, any way i can do this cleanly ?

Thank You.

Ive tried to do it with blueprints by adding World Rotation to my platform of the inverse of it’s current rotation. It doesn’t work and gives some strange behaviours, perhaps because it is locked by the Physics Constraint.

Rinterp between curret rot and 0,0,0? I don’t know about the motor stuff, need to look into the physics side of thing a bit more.

When I do this it just goes all over the place. I think that’s because the platform itself is affected by physics/gravity or because it is locked in position by physics constraint.

On second thoughts it might also be because the physics constraint limits all angular angles.

By finding the inverse of the platform’s rotation and using it as a parameter for “Add Impulse” , I’ve been able to always apply force towards the initial position of the platform without messing with the physics. There’s a lot of values to tune for it to work correctly in the physics constraints object.

I’ll mark this as Answered for now, but I’m still opened to better alternative or solutions.

EDIT : More info on my solution :

  • The physics constraint is set in the center of my platform on which i want physics. It has the linear limits to locked and angular limits to limited.

  • To add force, to stabilize the platform, I’m using blueprints and the Add Impulse Function :

“Rotation to do” is just the inverse of the platform’s current rotation. I multiply each individual value of that vector by a float to change the intensity of the rotation on each axis, you can tune it however you want.

Hi Sprawl,

Please feel free to post some screenshots of your setup so other users can easily try your solution.

Cheers,

TJ

Yes , of course. I’ve updated my answer.

I would use ‘set angular drive’ and ‘set rotation targets’ in blueprint.
Then use as rotation target your balanced position, ie. the angles for when it is straight.
Then the platform, or better: the contraint, will always aim to reach that postion.
By adjusting spring and damping of the angular drive, you can control how rapidly the platform attempts to go back to a balanced position.

This way, when you drop something on it, the physics solve inherently. It will be likethe platform is mounted on a spring constraint that is always pulling back to level position.

I’ve tried to have an angular drive, but it seems it has no effects when angular limits aren’t free and linear limits on locked.

Fortunately, coding that behaviour in blueprint turned out to be pretty simple.

it works. I used it (in v4.6). Make sure angular orientation drive is ticked in the details panel of the constraint. Can be zero force, but needs to be ticked for some reason. Then setting an angular orientation drive in blueprint works.
And make sure the spring is high enough in the set angular drive node.

I am using locked positions and limited angles on my constraint so the motors dont work. I wondered searched why it didn’t work and found this : Angular drive doesn't work with locked motions - World Creation - Epic Developer Community Forums

I have been using an angular motor all the time for this. In the pic is my self-balancing test ragdoll.
The link is for an outdated version. I think with the twist&swing option in addition to slerp it got possible.
But make sure, that the angular motor gets the difference between stabilized angle and tilt angle. (I posted this wrong above). Say tilt is 20° and balanced is 0°, then Orientation Target is -20°.
So needs constant updating.