Main forum > Bug Reports

MOUSEAXIS(0) and 1 inside X_MAKE3D

<< < (2/4) > >>

Hemlos:
The way glbasic was intended to be used is 3d first then 2d then showscreen, as a standard.
But it can be used in infinite ways.

If you follow a regiment for your mouse controllers, you will never have an issue with it.
The concept of mouseaxis records movement from the last time showscreen is called.
So you need to put it right before showscreen.

Not only will it always give a correct response, it will run with perfect precision at any frame rate.

Hemlos:

btw if you didnt realize, mouseaixs is good for 3d, as it is increments
this is accurate at the bottom of you loops.

mousestate is good too, it is exact position tho...not so good for 3d movement.
Its best for 2d positioning, and works fast at the top of the loop.

MrTAToad:
Never really tried MOUSEAXIS in 3D :)

Hemlos:


Well if you do heres a bad little func to handle time and distance compared to physical mouse movement...physics.



--- Code: ---// ======================================================================================== //
//  Super 3d mouse
FUNCTION SYS_IO_MOUSEAXIS:
//This function is for 3d mouse control, for moving player cam etc, based on time and distance of mouse movement.
// The idea is to make smooth and consistant mouse control behaviour no matter what FPS you/them are getting.
// GETTIMER() //you can only use this command once per loop!...so use it wisely throughout the entire program!
// Just use this reference of time FrameTime, this is in milliseconds since the last time showscreen is called.
// This function can only be called once.
// This function must, MUST be place exactly right before SHOWSCREEEN!
// If you use mousestate too....you should and probably will need to put it
// at the top of the main loop, it should work good there.
// Dont forget to DIM Mouse[5] // at the top of the header somewhere.
                FrameTime=GETTIMER()
Mouse[0] = MOUSEAXIS( 0 ) / SQR(FrameTime) * SQR(FrameTime)
Mouse[1] = MOUSEAXIS( 1 ) / SQR(FrameTime) * SQR(FrameTime)
Mouse[2] = MOUSEAXIS( 2 ) / SQR(FrameTime) * SQR(FrameTime)
Mouse[3] = MOUSEAXIS( 3 )
Mouse[4] = MOUSEAXIS( 4 )
MouseX = MouseX + Mouse[0]
MouseY = MouseY + Mouse[1]
MouseZ = MouseZ + Mouse[2]
ENDFUNCTION
--- End code ---

FutureCow:
Sorry, I disagree. There is no logical reason for having a link between 2D work, 3D work and reading data from the mouse. I should be able to call MOUSEAXIS at any point in my code and have it return the correct result. If I call it and it returns wrong/no information then it's a bug in my book.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version