- Home /
Billboarding a ball
Hi. I'm working on a pinball. I wish to billboard the ball in order to get a sprite shown above the ball. Always every post of billboarding recommend using a plane and the lookAt camera command. But what bout a ball, where the object rotates an moves in a lot of directios? How to attach a billboard image to it?
Answer by Danicano · Jan 28, 2017 at 12:07 PM
Keep investigating...... Look at the weird movement the sprite is doing when I attached the following script to it (VIDEO below):
Quaternion rotation;
Vector3 position;
void Awake(){
rotation = transform.rotation;
position = transform.position;
}
void LateUpdate(){
transform.rotation = rotation;
Vector3 newpos = transform.position;
newpos.y = position.y + 0.63f;
transform.position = newpos;
}
The sprite is a child object of the ball.
How can I manage the sprite to stay on the ball?
The sprite is child of the ball gameobject. The pinball itself is another gameobject imported from Blender. Two separate objects-
Click on the sprite gameobject and in the inspector make sure the sprite's position is set to 0 on the x, y, and z axis.
Your answer
![](https://koobas.hobune.stream/wayback/20220612104432im_/https://answers.unity.com/themes/thub/images/avi.jpg)