Self righting object on sphere
I have an object that is affected by a ConstantForce in a given direction.
I want that object to correct itself so that it's "up" vector will be the negative of the force vector.
Meaning, it should "stand upright" in a given "gravity field".
I've tried multiple approaches, but none seem to work, well enough, or at all.
//Look away from the force, add 90 degrees rotation on X axis, and Lerp to that.
//This flips the "up" vector after a certain angle.
var b = Quaternion.LookRotation(-_force.force).eulerAngles + new Vector3(90,0,0);
body.rotation = Quaternion.Euler(Vector3.Lerp(body.rotation.eulerAngles, b, lerp));
//Get the rotation needed to rotate from "up" to the new "up", breaks completely after a certain angle
var c = Quaternion.FromToRotation(transform.up.normalized, -_force.force.normalized);
I also tried using RigidBody.ForceAtPostion(), by pulling 2 sides of the object from 2 directions.
This worked, but the object either wobbles if the force is too weak, or jitters if it's too strong.
Your answer

Follow this Question
Related Questions
Animations unwanted movement and rotation after updating 0 Answers
copy rotation script doesent copy the full 360 degrees? 0 Answers
Mobile Gyroscope, make Camera always rotating towards zero point using Quaternion 2 Answers
Camera self rotation script problem 1 Answer
Get LineRenderer positions or perform a transformation to an array of Vector3s 1 Answer