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.

Dark GDK / Help WIth Right Click Mouse Look

Author
Message
Movian
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 6th Mar 2008 02:00
Hi,
i have coded done some standard cosing in other languages and had an idea for a game i wanted to try and make so i found this. While looking at the tutorials i tried to make a modification to the mouse look used in one so that it would only look while right click was held in and make the mouse disappear. I was successfully in this but when you initially right click the camera view Jumps. I can't figure out a way to make the camera stay still when you first click the mouse and then move smoothly. any help would be apriciated.

Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 6th Mar 2008 11:33 Edited at: 6th Mar 2008 11:42
i bet this is your problem

dbPositionMouse (dbScreenWidth() /2, dbScreenHeight() /2);

when your clicking the mouse its moves its position so in turn the camera jolts.

i use this code for mouse/camera control. also controls the player

Movian
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 6th Mar 2008 13:29
I tried the code that you supplied, however now as soon as the map loads the camera moves forware and i am unable to control it. Also if i do not set the mouse to the middle of the screen the camera still jolts when you first click the mouse. However it does work fine after that
kBessa
17
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 6th Mar 2008 14:21
Why don't you just remove the dbPositionMouse (dbScreenWidth() /2, dbScreenHeight() /2) ? The dbMouseMoveX and Y methods don't care where the mouse is.
Rye
21
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 6th Mar 2008 17:34
Its because fCameraAngleX and fCameraAngleY are still being changed even when the mouse button isnt pressed.

Then when you click, the camera angles are applied, therefore you will see a jump from the current camera angle to the one specified with fCameraAngleX etc..
Kurt
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 6th Mar 2008 21:58
Do it like this:

Movian
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 7th Mar 2008 02:58
Thanks for the help guys.

I finally settled on the following code (inspired by Kurts code) Which seems to do what i am looking for. (no pun intended) however i now get a camera jerk on right click release.

again any thoughts would be appreciated.
Tiomun
16
Years of Service
User Offline
Joined: 31st Jan 2008
Location:
Posted: 7th Mar 2008 12:56
that is odd i took that loop out of a working script i have and it doesn't jerk or jolt at all. it took me a while to get a piece of code that didn't lol

i still think its from the dbPositionMouse. try to comment it out on a test run and see if it still does it that way at least you know if that is the cause of the problem or not
Rye
21
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 7th Mar 2008 13:48
here is your solution..



The problem arises partly from the way dbMouseMove() works. You need to call this in your main loop and assign it to a variable. then you use that variable wherever its needed.

2nd problem comes from the dbControlCameraUsingArrowKeys command. This seems to take over some of the cameras rotation. Nice simple command, but its better to detect key presses. Requires more code, but u can get it to do EXACTLY what you want.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 7th Mar 2008 16:47
HERE HERE Rye!

Also... I personally get SICK of writing those stupid Controllers myself... So now I have a function that LOOKS kinda like the DarkGDK controlcamera etc.... Except it works how I want for development... And because I took the time to write it, every time I create a new test application or whatever... I just call it in my main loop and nto worry - it just works, and I can contrate on whatever it is I'm testing... viewing, seeing if I blow things up - count FPS whatever.

Work Smart Not Hard.... Unless you are working hard at being Smart LOL

Movian
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 7th Mar 2008 17:21
Quote: "The problem arises partly from the way dbMouseMove() works. You need to call this in your main loop and assign it to a variable. then you use that variable wherever its needed."


Shouldn't the code read like this then ?


Will try this in a bit.
BTW thanks for all the help with this peeps Much apriciated
Movian
16
Years of Service
User Offline
Joined: 5th Mar 2008
Location:
Posted: 7th Mar 2008 20:37
YAY!

Ok Final Version of code that Does exactly what i want

Creates a right click mouse free view with no jerk at either click or un-click and moves mouse pointer to the middle of screen while hiding the mouse while looking and un-hiding it when you finish.

Login to post a reply

Server time is: 2024-09-29 15:29:47
Your offset time is: 2024-09-29 15:29:47