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 Movement Help!

Author
Message
Firos12
17
Years of Service
User Offline
Joined: 6th Aug 2007
Location:
Posted: 8th Oct 2007 04:44 Edited at: 8th Oct 2007 05:00
Well i have made an FPS type system but when i rotate the mouse my camera keeps rotating in a 360 degree angle, i want to stop the camera at a certain angle like 90 so it doesn't keep going, like when i look down i want it to stop at a certain area heres my code can i get some assistance?

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 8th Oct 2007 19:13 Edited at: 8th Oct 2007 19:13


something like that. obviously you'll have to change the numbers yourself but...

http://jamesmason01.googlepages.com/index.htm
Firos12
17
Years of Service
User Offline
Joined: 6th Aug 2007
Location:
Posted: 9th Oct 2007 03:03
Well i added that piece of code, now the camera keeps snapping back to the position it stopped at, kind of like a rubber band effect.
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 9th Oct 2007 19:48
hmm... check your sync placement?

http://jamesmason01.googlepages.com/index.htm
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th Oct 2007 05:27
Make sure that the code which restricts the camera angle is before the lane which sets the camera angle.

You shouldn't need to store the camera angle to do this - alter your camera mouse move code to only change the camera angle if it hasn't reached the limit.

TDK_Man

Firos12
17
Years of Service
User Offline
Joined: 6th Aug 2007
Location:
Posted: 13th Oct 2007 10:32 Edited at: 13th Oct 2007 10:40
Well i was able to make this work now i need to know one more thing lol, I'm running a test of skill by making a simple Horror game, I'm trying to create a flashlight right? i got the flashlight control to work the light turns on and off like a real flashlight would, but now it seems like the Light that is supposed to be illuminating while the Flashlight moves but the actual light is fixed in one position and doesn't move with the Flashlight like i want it to not only that but, the light only seems to be illuminating one side. Can someone help? heres my code.



As you can see here:



I tried using the commands that are supposed to link the light with the flashlight but it doesn't seem to work. You guys can go ahead and test what I'm talking about lol, just back up while your playing and you will see the cube. I Have attached the one sound that i made by myself with my voice.

Attachments

Login to view attachments
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 13th Oct 2007 14:25
First off, you want to be repositioning the light every instance of the loop.
Here you're only positioning the light at the beginning of the code.

These 2 lines:

should be in the loop

Also, these lines don't need to be in the main loop:



If you have them at the beginning it will speed up your code a lot... unless you change the fog level at any point in your code then you would only ever use commands like that outside the main play loop

http://jamesmason01.googlepages.com/index.htm
Firos12
17
Years of Service
User Offline
Joined: 6th Aug 2007
Location:
Posted: 13th Oct 2007 21:01 Edited at: 13th Oct 2007 21:02
Where should i put this


line in the loop? just anywhere?
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 13th Oct 2007 23:04
between where you update the object/camera position and the sync.

http://jamesmason01.googlepages.com/index.htm

Login to post a reply

Server time is: 2025-05-31 21:22:43
Your offset time is: 2025-05-31 21:22:43