- Home /
how can i make pinball flippers work correctly?
i can get flippers to rotate correctly.i would like the left flipper to spin like 90 degrees stop then go back to origin after i Getkey.up. this problem has been about 1 month now. i wanted to figure it out on my own ,but im not getting anywhere.the flipper is made in blender.should i animate it there for the rotaion im asking about , or do it by script in unity?thanks Dimwood
You should really provide answers as answers so those of us who go through unanswered questions don't have nothing to do :P
this script just seems to make it spin in a big orbit.it does rotate but it rotates in a big circle and it just keeps spinning?what am i missing?its like the pivotpoint is a really far away
Answer by LeakySink · Oct 21, 2012 at 10:21 PM
You could create a parent object to use as a pivot and then use the flipper as a child. Then rotate the parent to achieve the effect you're after.
i added an empty, that helped with the rotation at the correct point.now how to stop the rotation and have it flip back to the origin? thanks im noob
var $$anonymous$$yRotation : float = 0; function Update() { if(Input.Get$$anonymous$$ey("a")) transform.Rotate(0,-10, 0);
if(Input.Get$$anonymous$$eyUp("a"))
transform.rotation = Quaternion.identity;
}
it's definitely an EXCELLENT IDEA to use a "marker" .. an empty object ... as a parent to get a ,more useful origin, etc. Great work @Leaky
BUT be sure to familiarise yourself with this amazing command,
http://docs.unity3d.com/Documentation/ScriptReference/Transform.RotateAround.html
you essentially can't make games without it - it's critical. cheers!
Answer by tddaniels · Mar 28, 2013 at 11:18 AM
I was having the same issue - came across this tutorial on youtube.