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 - where do the bullets go??

Author
Message
Maelstrom
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: United Kingdom
Posted: 14th Mar 2004 01:44
If i know the x,y,z position of the camera and the angle it's pointing at, how could you work out the x,y,z position the bullets would end up at. Say the gun (AK47) had a range of about 400 units. This could change if you where just using a pistol with a range of about 100 unit. Hope i've explained it ok
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 14th Mar 2004 01:53
Thats quite easy, im not sure if the syntax is correct (im not at my DBC pc )

you point the bullets in the right directions and move them



now you only have to move them when they are fired

Quote: "
UPDATED

Amd 2800+ | 1024mb pc3200 | A7N8eluxe | Ati Radeon 9800PRO 256mb
"
Maelstrom
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: United Kingdom
Posted: 14th Mar 2004 02:06
Thank for the reply Emperor Baal.

I'm probably me being a bit thick but i dont actually want to move an object. i just want to get the x,y,z of the maximum range the bullet could travel. My thinking behind this is that after you get that position you could use something like the intersect object expression to see if a collision occurs.
Tim Ballisto
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 14th Mar 2004 20:59
the below formula gets you the distance in units(rounded to the one's place) between the bullet and the camera.

Distance=sqrt((object position x(bullet)-camera position x())^2 + (object position y(bullet)-camera position y())^2 + (object position z(bullet)-camera position z())^2)

then use this code to kill the bullet when it the distance gets to 4000

if Distance>4000
add your commands to replace the bullet (like hiding and repositioning)
endif
Maelstrom
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: United Kingdom
Posted: 15th Mar 2004 20:55
After a chat with a friend he came up with the following code.

Login to post a reply

Server time is: 2024-09-22 00:21:01
Your offset time is: 2024-09-22 00:21:01