radar orthogonal line to plane

hi guys I’ve created a radar my self, for a spaceship simulator that I have created

the Radar was created from 4 gameobjects:

  1. radar - sphere (parent)
  2. center - plane
  3. centerPoint - small sphere that indicates point 0,0,0 in the radar (sphaceship location in the radar)
  4. enemies points - list of small spheres that represents the enemies

Im trying to streach a line from the enemies points to the center plane that indicates the object relative height (relative to the spaceship because its space) but so far without success

any help will be appreciated

thanks in advance


If your plane is always going to be perpendicular to the world Y axis then you can just perform a Raycast from the position of enemy ship sphere in world y axis direction. Now where this raycast intersets your plane will be the point on the plane is your second point. Now you can draw a line using Line Renderer with first point being the position of enemy ship sphere and second point we calculated above.

If your plane is not always perpendicular to the world Y axis then you would need to use Vector Projection to calculate this second point on the plane to draw the line.