Top down: Rotation look at mouse problem. How do i rotate with raycasting?

Martin Vaupell 2 years ago updated by Andrej 1 year ago 3

I was trying to have a top down, where character rotation, gets mouse position from mouse pointer and then rotates character facing it.

However, my attempt her, ends up in a crazy spinny loop, and it appears the angles of Y is also changing.
I tryed setting all the new vector3 to either 1 or 90 to keep the angle, but no luck.

As for raycasting, i find it strange that i dont have selected a plane or something to raycast against.

Any tips?   gladly appreciated

Bolt Version:
yes current
Unity Version:
yes current
yes irrelevant
Scripting Backend:
.NET Version (API Compatibility Level):
.NET 4.x

aww bollocks,,  just realized i posted in wrong forum..   'facepalm'

for raycast i use this flow with layer mask

Itried this and it made my square dissappear help!