LIFT (rotate) rigidbody at an angle and keep it there.

HELLO i am prototyping some game and i have a little probleme and i need your help.
i have a moving cube and i want to lift that cube at a certain angle say 50° and keep that angle (using addtorque) while the cube is moving forward any idea ?:face_with_spiral_eyes:

	//public float _stabTargetAngle;
	public float stabValue;
	//public float stabValue2;
	//public float stablizeFactor = 1f;
	//	public float yRotation = 5.0F;
	public float angle;
	void Update() {
		/*float num = Mathf.DeltaAngle(this.transform.localEulerAngles.z, this._stabTargetAngle);
		this.stabValue = num;
		this.rigidbody.AddRelativeTorque(0.0f, 0.0f, stabValue2);//num * this.stablizeFactor * this.rigidbody.velocity.z
		*/
		angle = transform.eulerAngles.z;
		if (Input.GetMouseButton (0)) {
						Debug.Log ("Pressed left click.");
			this.rigidbody.AddRelativeTorque (0.0f, 0, stabValue);
				}
		if (Input.GetMouseButton(1)){
			Debug.Log("Pressed right click.");
		this.rigidbody.AddRelativeTorque (0.0f, 0, -stabValue);
		}
		if (Input.GetMouseButton (2)) {
						Debug.Log ("Pressed middle click.");
			print(angle);
		}


You’ll need to calculate the torque needed for that.

After about 10 seconds of reading that, I’m betting your eyes start to glaze over. It’s heady stuff.

Instead, Perhaps it’s better to find another way to handle the problem. Perhaps an additional invisible collider that comes down on the side that’s in the air and keeps the block from falling down. Or having the actual block be a child of an invisible block that is still resting on the ground.

Hey did u achieved what u asked above…