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.

Newcomers DBPro Corner / mousemove command

Author
Message
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 13th Aug 2005 06:14
using dbpro.

if mousemovex()>=1
turn camera right 0,1
endif

if mousemovex() < -1
turn camera left 0,1
endif

for some reason this does not work they work fine independent of eachother but when using two of them together they dont seem to work.

anyway to fix this?
thinkdigital
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 13th Aug 2005 06:18 Edited at: 13th Aug 2005 06:34
What are you trying to do, make mouselook?

Attachments

Login to view attachments
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 13th Aug 2005 10:25
If you're using a mouselook thing, so that the camera turns with the mouse, you may want to use something along these lines:


If that isn't it, what exactly are you doing?

Milky the purple crab
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 13th Aug 2005 10:28
hey how do u make the camera follow the mouse in DBC?

I don't fear pain.....I fear feeling it.
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 13th Aug 2005 10:30
In DBC? Exactly how I coded it. It probably could be done in more ways, but this is simple enough. I use DBC not DBpro, but the commands are similiar.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 13th Aug 2005 15:10
I dun know...



*not tested

This should work for mouselook...

Immunity and Annihalation makes Immunihalation...
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Aug 2005 07:01 Edited at: 14th Aug 2005 07:10
I've not tried it, but I can't see master programmer's code working either.

In Sven's snippet, if you want to reverse the Y direction of the mouse, change the line:

anglex# = wrapvalue(anglex# - (mousemovey()/2))

to

anglex# = wrapvalue(anglex# + (mousemovey()/2))

This makes the camera look upwards when you move the mouse away from you instead of down. Depends on which you like the most...

[Edit]

Thought I should elaborate on why I didn't think mp's code wouldn't work. Basically, the camera, like objects, can be rotated 360 degrees on each axis. Try to rotate anything more than that and DB will throw a fit.

If you are getting the X position of the mouse to use for a rotation angle, then if you move your mouse further than 360 pixels across the screen your program will fall over.

That's why there is a command called WrapValue(). What this does is take a number and 'wrap' the value round if it goes over 360.

So, if your current Y angle is 350 and you add 20 on, Wrapvalue will take the 370 and wrap it around to 10 - giving you a legal value for the angle. Eg:

YAngle# = WrapValue(Object Angle Y(ObjNum)+20)

TDK_Man
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 15th Aug 2005 08:08
well thank you for the help guys i appreciate it but none of this code seems to work in my program dont have a clue why looks flawless, yet it does not work.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Aug 2005 08:24
Post your main loop code with the faulty mouse section in it and we'll try and fix it for you!

TDK_Man

Milky the purple crab
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 15th Aug 2005 09:19
Sven B: your code works but it is inverted

great now i can use it im going to muck around untill i find out how to change the invertedness

I don't fear pain.....I fear feeling it.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 15th Aug 2005 15:16

well here is my main loop work in progress guys. hope you can help me incorporate that code i alrady tried to change the angly# cause they would have conflicted but it did not make it work properly

A child's dream never dies.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Aug 2005 14:16 Edited at: 16th Aug 2005 14:16
Sorry bout that...

Immunity and Annihalation makes Immunihalation...

Login to post a reply

Server time is: 2024-11-27 20:51:29
Your offset time is: 2024-11-27 20:51:29