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 Professional Discussion / Sudden camera jerk, how to stop it?

Author
Message
Levanthus
23
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 17th Jul 2014 21:41 Edited at: 17th Jul 2014 21:42
Right, i'm not quite sure how to explain this one properly, i have a 3d first person point and click adventure i'm making, at one point you come to a puzzle like this:

now when you click on the keyboard you get a screen pop up where you have to click on the keys to type the answer, like this:

now after typing the answer the screen closes and the camera springs off in a random direction due to the mouse movement required to type the answer so you end up staring off somewhere else:


is there any way i could stop this from happening? i'd like the camera to remain pointing to where you were looking BEFORE you solved the puzzle... does that make any sense?

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 7 GB Ram, Radeon HD 4650, 3.6 TB HDD
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 17th Jul 2014 22:10 Edited at: 17th Jul 2014 22:16
I have ran into this problem even when I programmed a game in Java. I learned about States and what you can do with them. Games practically require them now days. What I mean by that is, instead of using direct usage of Keys and Mouse, you would use them as if its a 1 or 0. If its 0, obviously nothing happens, but if the loop detects a 1, then it reacts according to what mouse button or key or mouse X Y movement you run.

Once that is setup, then going in and out of a screen, such as you show in your pictures above, you would then store the info about your camera somewhere.. as well as your position BEFORE you enter the screen that you want to interact with, then once your done, you restore the position and rotation of your camera back to where it was before. If you set a 1 second delay before accepting mouse input, then the mouse would have no interaction with any of that.

It's a rough outline, but hopefully you can grasp how it would work.


EXAMPLE : Pseudo code :


WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 17th Jul 2014 22:18
I don’t know the extent of your code so far, I’m guessing you are using the mouse/camera routine in every loop. You can set up a variable as a flag and set it after the user has type the answer. Then put the
mouse/camera routine within a; if flag/endif condition. Then you will be able to toggle the mouse/camera routine at will.

Hotline
17
Years of Service
User Offline
Joined: 22nd Aug 2008
Location:
Posted: 17th Jul 2014 22:40
This is probably caused by NOT calling mousemovex() and mousemovey()
every loop. Make sure you call these two commands in your main loop

[href=forum.thegamecreators.com/?m=forum_view&t=191567&b=5]Spark Particle engine[/href]
[href=forum.thegamecreators.com/?m=forum_view&t=199163&b=5]Transform gizmo plugin[/href]
Levanthus
23
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 17th Jul 2014 23:07
i do have the mousemovex()/mousemovey() every loop
Turns out the Flag option worked... i knew it'd be something simple like that i was just having a major brain fart after staring at my code for near on 12 hours straight without sleep.

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 7 GB Ram, Radeon HD 4650, 3.6 TB HDD
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 17th Jul 2014 23:11 Edited at: 17th Jul 2014 23:16
Quote: "staring at my code for near on 12 hours straight without sleep."


That, will do it.

Dark Basic Pro X Collision
18
Years of Service
User Offline
Joined: 20th Sep 2007
Location:
Posted: 21st Jul 2014 23:36
You can save the rotation of the camera just before you enter the "computer" in the game. And when you leave the "computer" you can rotate it back to the previous values.

Login to post a reply

Server time is: 2026-07-06 04:28:07
Your offset time is: 2026-07-06 04:28:07