Search Unity

3D circular position relative to center

Discussion in 'Scripting' started by Bogaland, Oct 13, 2019.

  1. Bogaland

    Bogaland

    Joined:
    Feb 19, 2017
    Posts:
    32
    Hello!

    I want to create lasers similar to these:
    (about 19 seconds in). I'm using linerenderer, but I don't know how to calculate the end point of the lasers. I have my "laser emitter" which is the point where the lasers should start. But how would I calculate the end points?

    I'm thinking the position straight forward from the emitter is the reference point, and then a laser can be a certain amount of degrees from the reference in the two directions (two angles, one for each direction) on the plane perpendicular to the emitter. I tried to use spherical coordinates but couldn't figure it out. Is there a good way to do it using quaternions?

    Thanks for the help!
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Have you thought about using tools like Visual Effect Graph? It would be suited for this kind of stuff.
     
    Bogaland likes this.
  3. Bogaland

    Bogaland

    Joined:
    Feb 19, 2017
    Posts:
    32
    Oh I will check that out, thanks!