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.

Dark GDK / Shooting Help

Author
Message
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 8th Aug 2009 19:22
I need help making a firing object in my TPS game, i cant make an object appear at the player's position then move in the direction on the camera or cursor.
Potassium
15
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 8th Aug 2009 20:19 Edited at: 8th Aug 2009 20:25
Be more specific, and by TPS I assume its Third Person Shooter?

OpenXDK is a homebrew kit for developing XBOX applications, but it requires a modded XBOX and is much harder then XNA.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 9th Aug 2009 00:43
Ive never done it but have you looked at dbPickScreen() command, this can give you the 3D co-ordinate of the position of your gun-sights (which I presume is the centre of the screen).
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 9th Aug 2009 03:59
You could also create an invisible 3d box at the players position and goes as long as you want the gun to be able to fire. Then you could determine if the enemy collides with it and if you're shooting etc.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 9th Aug 2009 04:42 Edited at: 9th Aug 2009 04:44
What you could do is this...

1. When you click the shoot button record the camera's position into 3 variables (origx,origy,origz) and then position the camera at the tip of the gun and rotate the camera so it's pointing the same way as the gun.

2. Then save the camera's x,y,z position into 3 new variables (oldx,oldy,oldz)

3. Then move the camera forward how ever far you want the bullet to go.

4. Then record the camera's position into 3 even newer variables (x,y,z)

5. Use Sparky Collision's SC_RayCastGroup command to check if it hit an enemy (assuming you set the enemies up into a specific group and then checked against that group) If you did hit an enemy take away damage.

6. Reposition camera back to the original x,y,z variables.

(the oldx,oldy,oldz and x,y,z variables are used in the SC_RayCastGroup command)

Even though this is more code I like using this method better because then I don't have to make another object like the above method. I'll assist you in coding it if you give this an honest try first.

Use Google first... it's not rocket surgery!
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 9th Aug 2009 07:40
Thanks i figured it out a little earlier, I created a box and extended
it out if front of the player in such a way that it was lined up with the cross hair , then i check the object collision and if it were true
the object in contact lost HP.

Login to post a reply

Server time is: 2024-10-01 10:33:28
Your offset time is: 2024-10-01 10:33:28