Update position of billboard objects
I have a simple script that is trying to update the x-positions of two sprite game objects in an orthographic camera using the setWorldPosition function.
However, this does not move the scene objects from their original position.
In addition, updating the transform of the the sprites in the inspector panel does not change the position.
Any help?
Hi Andrew! For billboard's, you're going to want to update the bindingPoint of the Billboard's SpriteAligner component rather than the transform position. You can get a feel for this by moving a Billboard around and watching the Inspector panel. Notice how the bindingPoint position moves in the SpriteAligner component but the transform doesn't change. Here's the reference. See "bindingPoint": https://lensstudio.snapchat.com/api/classes/SpriteAligner/
You can also see how this is done in the Tween system. Check out the Tween system's TweenBillboard script which modifies the BindingPoint and Size of the Sprite Aligner.
https://lensstudio.snapchat.com/guides/scripting/tweening/
Hope that helps!
Thanks so much, this is exactly what I was looking for!
Just needed to be nudged in the right direction.
In the meantime I was able to get my desired functionality by attaching my sprites as children to empty game objects which were then parented to the orthographic camera. Is there any advantage to which method I take?
Thanks!
Technically works too! The main disadvantage is that it doesn't take advantage of the SpriteAligner component controlling the placement in relation to the screen. By moving the transform's parent, you'd be working in world space and not in screen space. The result might look correct on one device but incorrect on another device with a different resolution / camera FOV. But really depends on the use case if this is going to be problematic.
Got it! Thanks for the help :)