- Home /
Make 2D Ball sprite spin?
So I'm messing with two 2D games that got balls, and it would be a nice addition to both if I had a way to make the ball gameobject sprite rotate around itself when it bounces around the game scene.
It sounds simple but I searched for a while and couldn't find anything useful to add this feature. Thanks in advance!
Answer by Larry-Dietz · Dec 01, 2019 at 11:32 PM
Try something like this in the Update method of a script attached to your ball...
transform.Rotate(new Vector3(0, 0, 90 * Time.deltaTime));
This should rotate it 90 degrees, on the Z axis, every second.
Change the 90 to whatever you want. The higher the number, the faster it rotates.
Hope this helps, -Larry
I kinda did that, adding addtorque to the ball on its OnCollision function, it worked like intended
Your answer
![](https://koobas.hobune.stream/wayback/20220612215542im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Change object coordinates to another ones upon button press 2 Answers
Position bug on changing scale 1 Answer
teleportation problems (2d) 1 Answer
Pixel Perfect 2 Answers
Instantiate Object position C#, not visible after new pos 1 Answer