Contents
How to make a 2D character rotate around the mouse?
LittlefoxyUwU likes this. I created a new 2D project. I imported a Spirte (that was just an arrow pointing up). I copied your script and added it to my sprite. My arrow spun around all 360 degrees following my mouse.
How can I calculate my own mouse Delta?
I basically set up a test where I calculate my own mouse delta manually using the mouse position, and compare it to the cumulative passed delta during a frame as well as the most recent passed delta in a frame. Neither the cumulative nor the raw passed delta seems to be accurate. The cumulative is way off, the passed one is closer but still off.
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.
How does Delta time work on a joystick?
I understand for a joystick you would want to get the direction the joystick is pointing and apply that by a rotation speed * deltaTime each frame but for a mouse you are measuring how far the user actually moved the mouse since the last update (or in this case the last time OnLook was called).
Why does my 2D character spin 360 degrees?
Make a new 2D project with just single sprite and your script attached to it. You should see it spin 360. 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.
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.
Is there a way to rotate characters 180 degrees?
The code that’s the closest is the following: This code is simply attached to my player object. The code works fine from 0 to 180 degrees but does not work for the entire 360. Any ideas? LittlefoxyUwU likes this.