"Hacking" the lookAt function

So recently I’ve been delving into topdown shooter controls for a new project and was reading up on a shooting script when I came across something user “aldonaletto” mentioned that peeked my interest. He said:

Since you said ship, I suspect that you’re clicking the empty space - and this won’t work, because Raycast only returns true if some collider (at 100m or less, in this case) is hit.
If this is the case, a possible hack is to create a big plane (scale 10000,1,10000) in front of the ship at a big distance (5000, for instance) and delete its mesh renderer. Child the plane to the player, and remeber also to change the raycast to Physics.Raycast(ray, hit) to remove the distance limit.

My question is, is this a legit way of getting this done? Now obviously, if something works, it works, even if it is the tiniest bit gimmicky, but I guess what I’m asking is, is this a “good” way to get the LookAt functions to work in this context? Is there a better way to make things work or give the mouse something to “hit”? Personally, I’ve been using a rotation script based on player and mouse positions, but LookAt just seems like the better way to go, especially in a top down shooter.

Cheers!

Seems fine to me, though I think there are a couple of better solutions. At a minimum, you can use Collider.Raycast() instead of Physics.Raycast(). Collider.Raycast() allows you to cast just against the plane instead of all the objects in the scene. A better yet solutions is to use Unity’s mathematical Plane. Then you can use Plane.Raycast(). This solution involves no meshes, does not have issues with the the size of the plane, and is more efficient. If the plane is parallel to the camera plane (i.e. the camera is not at an angle with respect to the plane), then you can use Camera.ScreenToWorldPoint() as an even more efficient solution.

@aldonaletto knows all of this, so whatever solution he was outlining was specific to the question or perhaps the simplest solution for the situation.

It seems to me that the end result you’re wanting is their “click arrow.” Like, if they were click-firing a laser, this is where it would start and aim. You could then raycast, launch a rocket…whatever, using that click arrow.

As T27M hinted in a comment, the “click arrow” is built in the first step of a ray cast: Camera.main.ScreenPointToRay(Input.mousePosition);

That uses the imaginary front-plane of the camera as a start point (no need for you to make it.)