Please help?
#1
Posted 04 June 2012 - 03:32 AM
also how do I fix it where the mouse isn't so bad off in 3d mode. Like you can slightly move the mouse but the mouse coordinates go miles out of the way... Please help
#2
Posted 04 June 2012 - 03:36 AM
How do I make a 3d floor turn to point toward the mouse...
also how do I fix it where the mouse isn't so bad off in 3d mode. Like you can slightly move the mouse but the mouse coordinates go miles out of the way... Please help
How do you make a 3d floor turn towards the mouse?
#3
Posted 04 June 2012 - 08:38 AM
#4
Posted 04 June 2012 - 12:18 PM
Yes. Im making a top down 3d game with a 2d character and Im using d3d_draw_floor to draw that character, but he needs top turn to face the mouse...How do you make a 3d floor turn towards the mouse?
#5
Posted 05 June 2012 - 07:44 PM
As far as the mouse coordinates go, mouse_x and mouse_y simply give you the cursors coordinates relative to the window on your screen plus the coordinates of the active view. They are not related at all to what is being drawn in the window. If your mouse remains in the center of the screen, then it's very simple to get the coordinates of where you're pointing to with the mouse
/* xfrom, yfrom, zfrom, xto, yto, and zto are the corresponding arguments in d3d_set_projection() */ CamDist = sqrt(sqr(xto-xfrom) + sqr(yto-yfrom) + sqr(zto-zfrom)) /*Get the camera's directional vector's length*/ ZDist = zfrom/((zto-zfrom)/CamDist) /*Get the z-component in the camera's directional vector, normalize it, and use it to find how many times you add it to itself to get to z = 0*/ MouseX = (xto-xfrom)/CamDist * ZDist + xfrom /*Get the x-component of the camera's directional vector, normalize it, multiply it by the number of times we calculated above, and add it to the camera's looking location*/ MouseY = (yto-yfrom)/CamDist * ZDist + yfrom /*Same as above, but with y*/
If your mouse is not located in the center of the window, you'll need to use Yourself's 2d-to-3d conversion scripts. Just search for them, and you'll find them. They're pretty common.
#6
Posted 05 June 2012 - 10:18 PM
#7
Posted 05 June 2012 - 11:07 PM
#8
Posted 06 August 2012 - 01:48 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











