How to move an actor using the cursor (Mathematics)

Hello.
The cursor is in screen space, the 3D object is in 3D space.
I know what I need to do:

  1. construct an infinite plane (FPlane)
  2. project a ray in the direction of the cursor (DeprojectScreenPositionToWorld)
  3. find the intersection point

But how do I do this? What normal should I use for FPlane so that it is rotated the right way?

(post deleted by author)

This is so common that you have the math already provided in blueprint nodes.

Try this in your player controller:

The infinite plane is defined by a point (origin) and a normal (in my case it is horizontal so the normal points up)

The ray is actually a line form the camera to the mouse position multiplied by the trace distance. Keep your trace distance reasonably large depending on how far you think you might be from the plane.

The point is automatically calculated and a debug sphere is shown there.

Hi.
I know how to make an FPlane. But I don’t know which normal to choose. How can I rotate the FPlane so that it’s always aligned with the local axes and the cursor always hits the plane (regardless of the actor’s orientation). I think the camera rotation needs to be taken into account here.

You rotate the plane by choosing different normal.

It depends - local axis of what? Of the player pawn? In other words - what do you want it to rotate with? Usually you can take the up vector of any actor and convert it to world space and use that as a normal.

Cursor can never hit the plane if the camera is looking away from the plane so there is that…

From your comment it seems that I don’t understand what you are trying to achieve. Please explain where should the plane be located (in world space since you want the result there) and how it should be oriented.

PS. Also please explain how your mechanic should differ from the top-down example.