Im making a 3d space game where i want to rotate the space ship to a far off point in space in the direction of the mouse click. I have tried putting a sphere collider on the ship and using raycast hit to give me a vector 3 and align towards that but that is unreliable and doesnt work well. Is there a better way of doing this? I also tried using a plane but that doesnt seem to work as space is empty with no flat surfaces.,Im making a 3D space game and am looking for a way to rotate the ship to align it to the point in space the mouse clicks. I have tried putting a sphere collider around the ship to get a raycast hit from the mouse and rotate it towards that location but that seems unreliable and doesn’t work well anyway. Is there a better way of doing this? I also tried to make a plane but that doesnt work as empty space is not a flat surface.
The typical method for doing this is to use
ScreenToWorldPoint
with a depth value,
if you really want to have a true “click empty space” feel you could even make that depth value a random range between a min and max.
See this yt video for details.
I hope this helps, if you accept this answer please up vote it to help others facing the same issue find it easier.
thank you, goodluck.