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 / FPS Aiming Problem (3D)

Author
Message
Wasteland Seraph
15
Years of Service
User Offline
Joined: 1st Sep 2009
Location: Benton, Arkansas
Posted: 2nd Sep 2009 00:00
After following a few tutorials, I decided to just start building off of some of the sample code until I learn the ins and outs of the system a little better. When I tried to compile this code for locking the camera on my cursor (which supposedly will keep it in the center of the screen), it gave me an error and closed. Any suggestions?



When Russians and Americans entered space, both found pens didn't work. America spent thousands to make a working pen. The Russians used a pencil. Wisdom is greater than intelligence.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 2nd Sep 2009 01:38
LOCK OBJECT ON does not work like you think it does. You must specify an object number. The object you specify will then always appear at the same angle and position relative to the camera (good for FPS guns).

Try using the MOUSEMOVEX() and MOUSEMOVEY() commands to rotate the camera.



Wasteland Seraph
15
Years of Service
User Offline
Joined: 1st Sep 2009
Location: Benton, Arkansas
Posted: 2nd Sep 2009 02:45
To BMacZero:

Thanks for the response!

I'm sorry, but could you explain a bit more? I'm doing my best not to ask for any code (forces me to learn on my own a bit more ), but a more detailed explanation of how I can use MOUSEMOVEX/Y() would be nice.

When Russians and Americans entered space, both found pens didn't work. America spent thousands to make a working pen. The Russians used a pencil. Wisdom is greater than intelligence.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 2nd Sep 2009 06:47
MOUSEMOVEX/Y will return the difference between the mouse's old x or y position and the new one. It's the best way to detect mouse movement when all you're concerned about is the movement itself.

Here's some very basic code to look at:


(The 0.2 is just a multiplier to stop the camera from turning too much with slight mouse movements)



Wasteland Seraph
15
Years of Service
User Offline
Joined: 1st Sep 2009
Location: Benton, Arkansas
Posted: 3rd Sep 2009 04:04
Alright, lemme see if I understand at least some of this...

"hide mouse" - Hides the standard arrow cursor (Bear with me ><

position mouse etc. - Takes the screen and finds half both ways to find the center, then puts the mouse there

x/yrotate camera - tracks how much the invisible cursor moves so that the camera follows suit


Did I get that right? If I did, then could you explain the purpose of the matrix in this case? I still don't understand how to implement this, but if I understand it all I can come up with something.

When Russians and Americans entered space, both found pens didn't work. America spent thousands to make a working pen. The Russians used a pencil. Wisdom is greater than intelligence.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 3rd Sep 2009 04:26 Edited at: 3rd Sep 2009 04:27
Exactly. The matrix is just a random visual so you can actually tell it's working when you test it.

EDIT: You should check out some of the beginner's tutorials at the top of this board.



Deego
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 3rd Sep 2009 19:13
Quote: "I'm doing my best not to ask for any code"


Even if you don't want to ask for code, do searches for topics you need to learn and read the code people posted. Most people add excellent comments in the code that are great to learn from.
Wasteland Seraph
15
Years of Service
User Offline
Joined: 1st Sep 2009
Location: Benton, Arkansas
Posted: 3rd Sep 2009 22:02
Deego:

Granted, I just meant I didn't want to ask someone to do something for me. Existing tutorials are there for a reason, and I do my best to utilize them when I come across them.

Some things aren't discussed in full though, and that's when real learning and asking others comes into play for me.

When Russians and Americans entered space, both found pens didn't work. America spent thousands to make a working pen. The Russians used a pencil. Wisdom is greater than intelligence.
Wasteland Seraph
15
Years of Service
User Offline
Joined: 1st Sep 2009
Location: Benton, Arkansas
Posted: 6th Sep 2009 17:27
Alright, after fiddling around with your example code, I've almost completed the mouse look portion of my project. However, I've reached a block of sorts...

While I can look up and down (and all around the Y axis, including behind me, but I can fix that after I finish this), I cannot look side to side, and my crosshair, while in the center of the screen, jumps to the right whenever I fire, so that I'm actually firing about half way to the right side of the screen. It stays in the center, jumps when I fire (you can't tell unless you fire a lot, as it's too fast to really register if you just shoot once), and then is immediately back in the center. Here's what I have pertaining to this, lemme know if I forgot to give you something.



BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 7th Sep 2009 06:33
Can't see any problems with that code. It must be in a different part. Try just running through the code in order, seeing what each part does (kind of compiling it in your head). That often helps me find problems like that.



Wasteland Seraph
15
Years of Service
User Offline
Joined: 1st Sep 2009
Location: Benton, Arkansas
Posted: 7th Sep 2009 16:43
Sorry about the scattered code, I haven't started organizing it very well yet : /

Lemme know if you see anything wrong, please.



Login to post a reply

Server time is: 2024-11-25 01:45:35
Your offset time is: 2024-11-25 01:45:35