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 / i need help with simple fps (keeping gun near the camera...etc)

Author
Message
gpex
18
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 9th Jul 2005 08:52 Edited at: 9th Jul 2005 08:52
I've just started coding in 3d with models, instead of primary objects and i started this simple fps so i could get the hand of working in 3d a little more. I have a very simple surface to walk on and an mp5 model. i have the camera controls working(w,s,a,d to move and the mouse to look) but now i want the mp5 to stay in front of the camera like someone is holding it. I messed around a little bit trying to figure it out but i cant seem to get it. so i was hoping someone here could help me. Here's the code that i have so far...



the mp5 will follow me but it wont rotate around with me and stay in front of the camera. I figured out how to get the mp5 to rotate around its origin, and all that....i hope someone understands what i'm saying . Just basic fps control.


-gpex-

CodingCom Test Site...check it out!!!
http://www.codingcom.150m.com
BlackJack
18
Years of Service
User Offline
Joined: 9th Jul 2005
Location:
Posted: 9th Jul 2005 19:39
hey
i think you need to put "Lock object on" for my FPS game i used this codes for the gun position
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Jul 2005 21:20
Simple, just create a mesh of a tirangle with dimensions 0,0,0,0,0,0,0,0,0 (smallest object), add a limb using that mesh and offset it to the right and a little to the front of the user's object, delete the mesh, and hide the limb. Now just position the gun at the limb's position and rotate thegun as the user rotates.

The reason we didn't just make the limb out of the gun is that you cant play animations for limbs (I dont think...) and plus now when you have multiple guns you just position the gun at the limb when they equip it instead of making a new limb for each gun.

Goodluck.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
gpex
18
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 10th Jul 2005 06:10
oh, that makes sense now. Thanks ruccus, and black.

CodingCom Test Site...check it out!!!
http://www.codingcom.150m.com
gpex
18
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 10th Jul 2005 15:07 Edited at: 11th Jul 2005 03:50
i changed the code up a little bit with the limb stuff in there and it's not working. I checked if the limb exist and it did(to make sure i wasnt using the same object number twice.) So i dont know what to do. I messed around with it for a while and couldnt figure it out. This is the code that i have now(with the limb stuff) I hope you can spot what i'm doing wrong...because i cant.




-gpex-

(and i'm using the DBP trial...that wouldnt have anything to do with it would it?)


***EDIT***

ok, so now i wrote the values of the limb positions to a file and it was 0,0,0. I just thought that i would throw that out there.

CodingCom Test Site...check it out!!!
http://www.codingcom.150m.com
gpex
18
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 11th Jul 2005 03:53 Edited at: 11th Jul 2005 03:55
Now i went and tested it with this code...



All this does is check whether or not the object and the limb exists then positions the parent object at the same position as the camera and positions the gun at the same position as the limb and checks to see if the limb position and object position are equal and if they are then it ends the program. And the program ended...so i have no idea whats going on......i'm just extremely comfused.


-gpex-

CodingCom Test Site...check it out!!!
http://www.codingcom.150m.com
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 11th Jul 2005 04:04
Ok Ill look it over and get back with an answer in a bit.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 11th Jul 2005 04:43
Ok I've checked the code and its pretty messed up . You've jumbled up some numbers, deleted objects you shouldn't have, and all around done it wrong (Im pretty sure atleast o.O).

So, RUCCUS to the rescue, here's a snippet showing how you use limbs and how you'd accomplish positioning a gun beside the user and having them hold it.



Goodluck, hope it helps, if you still have any questions feel free to ask.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
gpex
18
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 11th Jul 2005 05:12
Sweet, i got it now. Thanks for taking the time to do that for me. It was the glue object and the checklist commands that did it.

CodingCom Test Site...check it out!!!
http://www.codingcom.150m.com
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 11th Jul 2005 05:13
No prob, always good when it helps someone.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection

Login to post a reply

Server time is: 2024-04-20 06:58:38
Your offset time is: 2024-04-20 06:58:38