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 / how to restrict free mouselook range?

Author
Message
Guruchild
23
Years of Service
User Offline
Joined: 13th May 2003
Location: United States
Posted: 20th Jun 2003 03:15
Right now my FPS engine is shaping up nicely however I'm stuck on how to restrict the free mouselook range. What I means is if you assume your character is a humanoid, then they shouldnt be able to look any higher than straight up and and lower than straight down. Right now you can freely look anywhere including rotating the camera all the way around so the landscape is on the top of you not the bottom.

At first I set out to solve this problem by noting the character object's angles when looking around and setting up conditions to reset them if they are too high or too low. But the problem is the angles wrap around 360 making it impossible for me to figure out how to write them so they work as intended.

Help?
Trowbee
23
Years of Service
User Offline
Joined: 12th Apr 2003
Location: United Kingdom
Posted: 20th Jun 2003 04:52
I guess you could use something like this:



angle 45 is the lowest angle you want to be able to use
angle 315 is the largest angle you want to be able to use
145 is half way between, and used as a trade-off to determine from which direction the character was previousely looking
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 20th Jun 2003 07:20
Yeah, just restrict the variables being fed to the camera rotation code.

--Mouse

Famous Fighting Furball
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 21st Jun 2003 17:37 Edited at: 21st Jun 2003 19:43
a simplified version of mouselook could be this.



Hehe simple 4 lines and you get restricted mouselook movement

Reset

Login to post a reply

Server time is: 2026-07-11 14:56:08
Your offset time is: 2026-07-11 14:56:08