IsStanding Method trouble

Hi guys,

my pins were wobbling and I figured this was the issue for my pins not being detected. I have tried a lot of diferent solutions posted on the forums ranging from decreasing gravity from -981 to -20, changing the solver iteration count to 10, and I have manipulated my code in the isStanding method to this.


Vector3 eulerWithoutTwist = Vector3.Scale (transform.rotation.eulerAngles, new Vector3(1,0,1));
		
		Quaternion rotationWithoutTwist = Quaternion.Euler (eulerWithoutTwist);
		
		float tiltAngle = Quaternion.Angle(rotationWithoutTwist, Quaternion.identity);
		
		return (tiltAngle < standingThreshold);

I also read on here that this could be an issue relating to the gimble lock which could create an issue where both the axes will allign and then be counted as one in the same allowing the unity engine to do be able to determine the angle that is being displayed. Any help would be appreciated as I can not determine the amount of pins standing up and thus getting my pins to lift and lower is impossible.

Thanks

Tim

Changing the X value of the new Vector3 in eulerWithoutTwist to 0 will allow IsStanding() to successfully count the pins. I’m not sure what the math is, on that, but it works. For some reason, all multiples of 4 seem to work, as well.

Privacy & Terms