Pinball physics fail

I’ve been working hard the last week to came up with a solution to this problem. See the video below please, it’s worth more than any word.

The lever is a child of it’s pivot. The pivot has a hinge joint, limited in the rage of the lever movement.
Thru a script, when I press the left button, an up torque is applied. If no key is pressed, a down torque is applied by default (to keep it down). NO animations are used, only straight unity physics (using animations already gave me a worst failure!).

If I were a damn sphere of mass 0.1 if would surely get the hell out of there if i were kicked by a mass 1 angry lever powered by a constant torque of 10000. I even set the collider of the lever to “bouncy”.

You may need the script attached if you want to investigate the problem.

#pragma strict

private var leftDown : boolean = false; 

function Update () {

	if (Input.GetButtonDown("left")){

		rigidbody.AddTorque(Vector3.down * 10000);
		leftDown = true;

	} else if (Input.GetButtonUp("left")) {

		leftDown = false;
		rigidbody.AddTorque(Vector3.up * 10000);
		
	}
}

function FixedUpdate(){

	if (leftDown)
		rigidbody.AddTorque(Vector3.down * 10000);
	if (!leftDown)
		rigidbody.AddTorque(Vector3.up * 10000);

}

What are the rigidbody stats on the pinball? how much drag and angular drag? That might be your problem

Default values but I’ll try to tweak them now.

I’ve solved by applying a fixed joint on the collider and connecting it to the hinge joint of the pivot. Apparently, moving stuff around using the hierarchy (making an object slave of another, and then moving the master so that the slave will follow) will have bad results on physics (you can’t rely on the slave object to interact with other rigidbodies, above videos shows results).

Using fixed joints did the trick for me!

Just in case someone’s interested and reading this, I’m posting the video after the correction.
Here’s the video, problem solved even if there’s A LOT of space for improvements! Any suggestion is greatly appreciated :slight_smile:

Well done, that saved me a headache