Orienting a instanced Objects long-axis to the same point
Hi guys, I know should be easy but i'm very fresh on Unity! I'm in a 2D environment, i have a sun, and i will instance some rays, long and narrow. Rays will spawn randomly with an end inside the sun disc area. So, how can i set the ray rotation (on z) to make the long axis pointing always the center of sun? I need a temp vector?
I tried some code but results are far to be good. Thanks to all that will have time and patience to land some tips!
Answer by kyntaro · Dec 06, 2016 at 02:34 PM
[SOLVED] So, that's fine enough. I'd created a parent-child structure on ray, with an empty object as parent. I'd adjusted the parent's pivot on the ray long axis, out of the shape, at a distance from end based on sun width, then i made the prefab. Now i have just to instantiate the prefab on sun center, with random z value...and i got it!