- Home /
How Do I Add speed to my rotation
I have two scripts for pinball flippers... They rotate where they are supposed to, but it's so fast that collision isn't being detected by the ball when they are moving! I looked all up and down google for a solution to my problem, but I'm not getting anywhere
Please HALP Me! Thanks!
function Update () {
if(Input.GetButtonDown("RightFlipper")){
transform.Rotate (0, -81, 0);
}
if(Input.GetButtonUp("RightFlipper")){
transform.eulerAngles = Vector3(0, 277.81, 180);
}
}`
function Update () {
if(Input.GetButtonDown("LeftFlipper")){
transform.Rotate (0, 81, 0);
}
if(Input.GetButtonUp("LeftFlipper")){
transform.eulerAngles = Vector3(0, 180, 180);
}
}
Also I can't ask my questions 3/4 of the time because of the tag error? And it doesn't give me tags to select from? Not sure how after however many years this is still a problem with the site?
Answer by highpockets · Mar 08, 2014 at 02:11 AM
Check this out:
does the ball or the flipper have a rigidbody attached? Or do both?
I decided to go with a hinge joint because the flipper was going through the ball with rotate for some reason. The ball is the only thing in my project with a rigid body. It's all working how I want now, but for future reference I would still like to know how to change the speed of transform.rotate (as that was my question here).
Well, this would rotate 1 degree a second on the y axis, which is really slow:
transform.Rotate( 0, Time.deltaTime, 0);
but of course you could multiply it by how many degrees you want it to move per second and make it negative to go the opposite direction:
transform.Rotate( 0, -Time.deltaTime * 10, 0 );
That would rotate it in the opposite direction at a rate of 10 degrees a second. You could find out the angle either by calculating the time that has passed or of course by checking the euler angles.
that might work.. would need a clamp but I think that would be pretty good.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135655im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Slowing Down Rotation Speed 1 Answer
Object Rotation/Character Speed 1 Answer
Player won't look in direction and travel at the same time? 2 Answers
Sprite facing object to mouse 0 Answers