The projection of a point onto the surface of a cube

There is a cube placed at the center of a scene. And I have to build a projection of a point to the surface of cube which is rotated (to build a Line from a Point to the surface at a right angle)? Do you have any ideas how i can do this? :slight_smile:

The point is going to be placed randomly. I know that i may use Roycaster for that, but I don’t know how i can do this.

Could probably be done with either Raycaster or some vector magic - could you specify what kind of projection though? Maybe a sketch / visualisation, how you pick the point, how is it placed relative to the cube and camera.

thanks, i just added additional info

How would the projection behave assuming:

  1. Cube is at (0, 0, 0) with size (1, 1, 1)
  2. Point is at (2, 2, 2)

There’d be no right angles between any of cube’s walls and the point :thinking:

1 Like

For example:
there must be a case when it’s possible to build a projection. for example, the cube is located at origin, it has a size (6, 6, 6) and the point is at (2, 8, 2) (i hope it’s correct).

One picture worth 1000 words. :slight_smile:
Could you provide an explanatory pic? @aadereiko

So point’s projection with right angle on the positive Y-axis (top) side will be [2, 3, 2].
But I agree with @mjurczyk, that there are places, where you won’t get projection with right angle to any side of the cube at all.

1 Like

I meant something like that :slight_smile:

I thought that the right angle and 90 degrees look not like that :thinking: