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 / Arming Yourself in the FPS View

Author
Message
Ambitious Guy
16
Years of Service
User Offline
Joined: 1st Aug 2008
Location: Florida, USA
Posted: 21st Jan 2009 17:22
Well how do you give your self a gun while your is the FPS view.
here is my FPS code:


The Geek of our time
Tom0001
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location:
Posted: 22nd Jan 2009 01:53 Edited at: 22nd Jan 2009 01:58
Just a note, you may want to use an unseen object such as a sphere as the player object, as this way it may be easier to load the model of the gun in at a specific place, say 'Object Position X(1)+2' or something like that.

Anyway, I think the command LOAD OBJECT should do it. o.o

EDIT: After loading the gun in, you should be able to place it wherever you want using the POSITION OBJECT command. After this, you'll have to script all of the separate parts of handling the gun, such as shooting animation, creation and handling of bullets etc.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 22nd Jan 2009 02:51 Edited at: 22nd Jan 2009 02:52
I use the following code to position guns onscreen:



Where GunObject is your gun object ID, the PlayerPos vars are the position of your player, PlayerAng is the angle/rotation of your player, and the gun offsets position the gun onscreen. Basically, a higher GunOffsetZ will put your gun out farther. A higher GunOffsetY will position it higher on the screen, and a higher GunOffsetX will position it more to the right. Experiment with different values for those to see which fits best.

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 22nd Jan 2009 03:44
I use the LockObjectOn command (for darkgdk).
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 25th Jan 2009 18:07
You can use the Lock Object On command as Puppy of Kosh mentioned, or you can simply do what AndrewT mentioned and position the gun model at the camera, rotate it to the camera, move it out, and move it to the right/left. It usually takes some time to get this perfect. I know it did for me

Good luck!
Xeno


Pillarofire
20
Years of Service
User Offline
Joined: 31st Dec 2003
Location: Good Question, <looks around.>
Posted: 26th Jan 2009 04:09 Edited at: 26th Jan 2009 04:11
A lot of people use a limb that is attached to the player object so that you get the same effect as AndrewT mentioned, without worrying about moving the object every cycle.

Here is some code that does this:



EDIT: changed keystates to 17 and 31
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 26th Jan 2009 08:32
What I do is: in the model file, you just offset the model and in game, you position it to the player. No mess, just takes a while to perfect the offsetting in the model file.
Ambitious Guy
16
Years of Service
User Offline
Joined: 1st Aug 2008
Location: Florida, USA
Posted: 28th Jan 2009 02:51 Edited at: 28th Jan 2009 03:59
@AndrewT: I don't understand the PlayerPosY, PlayerPosX and PlayerPosZ in your source code.

The Geek of our time
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 28th Jan 2009 04:11
Those contain the position of your player; most likely your camera.

Login to post a reply

Server time is: 2024-11-16 03:00:37
Your offset time is: 2024-11-16 03:00:37