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 / Movement problem (W,A,S,D not working properly)

Author
Message
Reality Forgotten
FPSC Reloaded TGC Backer
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Wichita Falls TX
Posted: 3rd Feb 2007 18:08
Language type: DBPro

Here's the problem:

After placing this snippet. I get the mouse to do what I want it to.


After palcing this Snippet, I can not get the camera to move. It will move a very tiny bit but always resets to the origional camera position stated upon creating the camera.



I searched the forums and spent the last 3 hours reading. I can not find a solution to my problem. At first I was thinking maybe the camera is stuck in the floor of the model. I dismissed that when I reposition the camera above the floor.

Thanks in advance!

Regards,
RF


Reality Forgotten
FPSC Reloaded TGC Backer
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Wichita Falls TX
Posted: 3rd Feb 2007 18:18
Ok, I removed the "Position Camera" snippet. and the W,A,S,D commands work now. My next questions is how do I get the mouse to affect the position of the camera?

Point: If I'm holding the fwd (W) key and I rotate the mouse to face the ground, How would I get the camera to follow and travel towards the ground?

Regards,
RF


Dr Manette
18
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 3rd Feb 2007 21:35
This is how I move (mouse and keyboard movement):



Bio Fox...four guys, one computer, games like nobody's business. Join our forum: http://www.biofox.aceboard.com
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 3rd Feb 2007 21:56 Edited at: 3rd Feb 2007 21:58
Heres a function that'll handle it all, just fill in the parameters:



If you're wondering how the movement line works, just follow it through. When you check if a key is pressed, you'll get either a 1 (pressed) or a 0 (depressed). If you subtract the W key's state from the S key's state, you'll get either -1 (If the S key is pressed and the W key isnt), 1 (If the W key is pressed and the S key isnt), or 0 (if no keys are pressed).

You also know that the MOVE CAMERA command accepts a positive or negative value, positive moving the camera forward, and negative moving the camera backward.

Putting that together, if we move our camera by a value of WKey - SKey, it'll move forward at 1 unit/loop when the W key is pressed, and backward at -1 units/loop when the S key is pressed. Similarily, it wont move when neither key is pressed, or when both keys are pressed.

Finally, we multiply the value returned from that little formula (WKey - SKey) by the moveSpeed# variable. So if you want the camera to move at 0.5 units/loop, you set moveSpeed# to 0.5.

Here's a test program to experiment with:



Hope that helps clear things up a bit,
- RUC'


:: Check out the new FPS Tutorial's Progress at http://www.freewebs.com/ruccus
along with code, media, and more.
Reality Forgotten
FPSC Reloaded TGC Backer
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Wichita Falls TX
Posted: 4th Feb 2007 02:48
@Dr Manette- Thank you! This Fixed my problem.

@Ruccus- Thank you! I am going to mess around with that test program so that I may gain a little better understanding of things.


Regards,
RF


Login to post a reply

Server time is: 2024-11-26 00:38:58
Your offset time is: 2024-11-26 00:38:58