Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / mouse wheel problem

Author
Message
Dr Manette
19
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 2nd Jun 2006 01:09
For starters, I did use the searches, so please no comments about me not doing so. Anyways, I noticed that when using the mousewheel, my game rotates around the camera! Is there a way to stop this as it messes up my fps greatly.

Bio Fox...four guys, one computer, games like nobody's business.
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 2nd Jun 2006 17:21
post a code

Don't look at my sig!
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 4th Jun 2006 14:06
Well, that really doesn't tell us anything...

What do you actually want it to do?

And yes, code would help - preferably with comments in it so people can see at a glance what you want various bits of code to do.
Dr Manette
19
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 4th Jun 2006 17:13
There isn't any code, because this happens whenever I make an object and allow the camera to move around. Here is an example, try moving the mouse wheel and see what happens:
Notice how the plain rotates around? I don't know why...

Bio Fox...four guys, one computer, games like nobody's business.
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 4th Jun 2006 17:59 Edited at: 4th Jun 2006 17:59
Thats because you're asking for the z movement, the z movement is the mouse wheel movement. Change mousemovez() to mousemovey(). Remember that y on the screen is up and down, and y in the 3D world in terms of rotation is left and right. Same goes for x rotation in the 3d world being up and down, and onscreen is left and right.

<EDIT>

You should also put a sync in there.

SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 4th Jun 2006 18:17 Edited at: 4th Jun 2006 23:44
Quote: "rotate camera cx#,cy#,cz#"


you haven't defined a cx# in that code, so if that's everything, it will never rotate up or down...

rotating on the z-axis is not what I think you want to do... take me standing up on two feet, with arms down by my sides. If I rotated on the z-axis through 90 degress I would be lying flat on my right arm. Is that the rotation you're after in your object?

Assuming it is: mousemovez() works a little different to x and y, the minimum rotation of a mousewheel is +/-120 (well, it is for mine at least) but after it's been read, it doesn't set itself back to zero, so every frame is going to rotate around the z-axis 120 degrees (exactly 1/3 of a circle). if you move the wheel again in the same direction, it will now read 240 and so will rotate 240 degrees around the z-axis. Move the wheel again in the same direction again, and it stops...
No, it's not back at zero, its now +/-360... A perfect circle!

So, how are you going to get round this? best bet, another variable... for example, OldMouseZ. Read mousemovez() and OldMouseZ - if they match, the wheel didn't actually move, it just hasn't been reset. finally, part of you code is to z-rotate the value of mousemovez() - OldMouseZ... if no movement, the difference will be zero, so it just won't rotate, and if it has changed, it only moves once. Finally, after the movement, but before the loop statement OldMouseZ = mousemovez() otherwise OldMouseZ will stay at zero...

Edit: I see Ruccus got in first - did that really take me 25 minutes to write?
Dr Manette
19
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 4th Jun 2006 18:32
Thanks ruccus and simsmall, I guess it was pretty stupid having that piece of code in.

Bio Fox...four guys, one computer, games like nobody's business.

Login to post a reply

Server time is: 2025-05-25 06:30:59
Your offset time is: 2025-05-25 06:30:59