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 ?
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.
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.
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.
“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.
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.
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 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.