(holding down left click will rotate the ship to face the mouse cursor)
I’ve been trying for a lot of hours over the past couple of days to recreate movement like you see here in the video, but I’ve came across quite a few issues.
The first time I implemented it, it worked okay. I could hold down the left mouse button and my ship would rotate to look at the mouse. It did this instantly, so I added some interpolation in there and then it did it a bit smoothly. However there were a few issues.
When I tried to do a 360 (I’m not sure what the name of the axis is, but it involves the pitch), it stops when I’m looking directly up or directly down. I can’t do a full 360 and go upside-down. I read somewhere that this issue is called gimbal lock (so I believe) and can be solved by using quaternions. From what I remember I could make the ship rotate a full 360 degrees using this method, but the moment I changed it so that it was rotating to face my mouse cursor (the rotation for the mouse cursor is retrieved by getting the world vector for the cursor and then getting the rotator from that vector).
Upon moving the camera using my first method (I mean on the component), if I want to reposition the camera which is attached to a spring arm, it will mess up the movement.
In the game you can see how the ship will move to the left, right, top or bottom of the screen depending on how far away your mouse cursor is while your moving (so the larger the angle), the camera kind of lags behind the ship a little. I do not know how to achieve such an effect and I have no idea what you would call this effect.
With that set up the actual ship itself will rotate on all axes to face the mouse cursor and it will do it smoothly as well. Again, I have no idea how to achieve this effect. My pawn also stops rotating instantly as soon as you release the left mouse button which can look very unnatural and it doesn’t feel very nice to use.
I know I have covered a lot of issues here, but I really just need some guidance on the basic logic on how to do these things. I’m sure I could eventually tackle Issues 3 and 4, but the first two Issues I have no idea how to resolve and they’re the two main ones. Issue 1 is my priority though and I’ve been ripping my hair out trying to fix it.
If you have anything that you think can help me, please post.