Original Post
Hi, I'm making a 3D aircraft railshooter based on Starfox, and I'm having trouble. I don't really know what would be the best way to get the aircraft up/down left/right movement controlled by mouse cursor movement. Basically, I want the aircraft to follow smoothly the cursor, and turn towards it, so the shooting position matches the cursor.
I tried a few thing but it didn't work properly.
First,I calculated 2 ratios between the mouse position and the screen size, Xratio and Yratio. I then computed the bounds of movement of the aircraft, and calculated the target position multiplying the width and height of the bounds to the corresponding ratios. This gave me coordinates that I used to place the aircraft in the world. However, the crosshairs didn't match the firing position with this approach, and it was kinda inacurrate for aiming.
Then I tried to convert 2D screen mouse cursor position to 3D space position. However, since the "camera lens" is tiny, the mouse wouldn't make the aircraft move much from its default position, and it wouldn't cover most of the moveable area !
At this point any suggestion is welcome !
I tried a few thing but it didn't work properly.
First,I calculated 2 ratios between the mouse position and the screen size, Xratio and Yratio. I then computed the bounds of movement of the aircraft, and calculated the target position multiplying the width and height of the bounds to the corresponding ratios. This gave me coordinates that I used to place the aircraft in the world. However, the crosshairs didn't match the firing position with this approach, and it was kinda inacurrate for aiming.
Then I tried to convert 2D screen mouse cursor position to 3D space position. However, since the "camera lens" is tiny, the mouse wouldn't make the aircraft move much from its default position, and it wouldn't cover most of the moveable area !
At this point any suggestion is welcome !