I am working on a 2D pinball game and I need to make it so the texture of the ball does not rotate with the ball. In other words when the ball is spinning as a result of physics reactions on the table I want the texture/sprite image to not spin with it. So the ball will move around the table as it should but the image of the ball itself will not rotate as the ball moves.
Is there an easy way of doing this?
Freezing the angle will not work as that will effect the physics of the ball.
Insert a second sprite of the same kind that you want moving with no rotation into the scene and do NOT parent it to the sprite you want to mimic. Manually set the position and scale in the selector so its the same as the original. Now turn off the sprite renderer of the original object and attach the script below to the new sprite and it will replace the physics sprite on the screen and wont rotate.
(Javascript)
function FixedUpdate () {
var myobject = GameObject.Find(“object-I-want-to-mimic”);
transform.position = Vector2(myobject.transform.position.x, myobject.transform.position.y);
}