Contents
Is there a 2D object to rotate to mouse?
Sign in to stay up to date. 2D Object to rotate to mouse. I’m trying to make a 2D shooter where the gun follows the mouse and fires in the direction you are aiming. I’m trying to get the gun to rotate to follow the mouse right now and I’ve tried But the gun isn’t rotating at all, what am I doing wrong?
Is there a way to rotate a GameObject?
I have a GameObject in my scene and I want that GameObject to rotate so it faces my mouse when I click it. After the rotation it’s supposed to move in the direction it is now facing. However it almost works.
Is there a way to rotate a cube to the mouse position?
It’s called “cubetest”. I don’t get what I’m doing wrong. It should rotate all the way around 360 degrees (the red part is my “pointer” for the cube). I just downloaded and tested the project – the script runs flawlessly here – the red line exactly points towards the mouse position at all the places on screen – no console errors either.
Why does my character rotate towards the mouse?
If it does you know something else is going on in your project where it isn’t working. One thought.. is your sprite symmetrical along the x-axis. That might make it seem like its not spinning when it is. I tried to make a simple cube sprite and it still doesn’t work. Do you mind attaching your arrow sprite so I can try that one?
Is there a way to rotate a gun in Unity?
But still the Gun does not rotate at all, I’ve set several of the values to public and watched them and they work, it seems like LookAt just isn’t doing anything. except now that it’s rotating on the wrong axis (X) when I want it to rotate on the Z axis.
Why does my arrow point at the mouse?
My arrow spun around all 360 degrees following my mouse. So my arrow would actually point directly at the mouse (since i drew it pointing up to start with). but that was irrelevant to the actual spinning full 360. Even without that line your code spun my sprite through the full 360 degrees. Try duplicating what I did.