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 questions

Author
Message
aarrowh
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 24th Sep 2009 19:39
Hey guys, been a while since I've posted, been busy with school. But I'm working on an FPS but there are a bump I've run into and just some general questions I have

First I'll start off with the problems I'm having.

I can't seem to make my gun get into the correct position, I'm using the LOCK OBJECT ON command and it no matter what I've tried it just won't get to where I want it.

Code



Also, I was wondering about shooting, I've heard many different methods used for shooting but I do not know which way is the best or how to do some of them. I know I could use objects with arrays to shoot. Or use sparky's DLL to use raycasting, but I don't know how to use raycasting.

Finally, I can't seem to get the camera to follow my player(a cube) I've tried different commands and spent a couple hours trying to get it to work but to no avail.

Any help/advice would be awesome!

*note* I'm trying to keep from asking for code so if at all possible please explain in detail. You don't have to but it would be awesome



Image thanks goes to AndrewT
BowserYo
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 25th Sep 2009 00:42
The way you get your camera to follow a player is like this:

You need to get your players x,y and z positions after you move your player. Example: x# = object position x (player).

Then, in your main loop position camera to those updated positions:



So in your main loop you want something like this:

1)movement code
2)update player positions
3)set camera to those positions

I can give you code if you want.

ßõw§€r¥¤
aarrowh
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 25th Sep 2009 02:35
Thanks for the help! I did it backwards... I tried to set the objects position to the camera... Thanks a ton!



Image thanks goes to AndrewT
BowserYo
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 25th Sep 2009 20:36
Yessir glad I could help. As for the lock object on, You are going to want to have your camera at 0,0,0 (if you have the camera positioned at like 0,10,0 thats fine, in other words just have the x and z at 0) then position your gun at like 0,10,5. Get your gun at camera level (or a little below, and too the right) then move it forwards at bit, once you have it were you want it position lock it:

This should be before your main loop, while you are still loading/making your objects:


You may need to put the lock object on in your main loop I can't remember. But it should be locked after you position it.

Let me know if that works for you!

ßõw§€r¥¤
aarrowh
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 25th Sep 2009 22:14
The camera works fine, now I just need it to turn with the mouse (not too hard) but the positioning the gun isn't quite working. It won't go any lower then just under the middle of the screen. I've been messing around with the placement numbers but still cannot seem to get it where I want it.

Gun placement code.




Image thanks goes to AndrewT
Veron
18
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 26th Sep 2009 12:03
I try not to use lock object on when positioning a gun. I prefer to have the gun positioned at the same position as the player in a loop, but just increase the z by a little bit so it pokes out in front of the player.

That way, it becomes a lot easier to adjust if things like gun animation come into play, as well as things like scopes.

Login to post a reply

Server time is: 2024-11-25 01:31:51
Your offset time is: 2024-11-25 01:31:51