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.

Author
Message
Iain
19
Years of Service
User Offline
Joined: 17th Jun 2004
Location: UK
Posted: 9th Oct 2006 04:08
How can i make a bullet shoot out a gun with physics on it, so it moves fast and will affect thjings it hits.
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 9th Oct 2006 12:50
i am sure DarkPhysics have some sort of Intersection commands (if it does not, you can use Sparkys Dll).

so start at your camera position. (x# = camera position x() etc.)
when you click the fire key, move the camera by 3000 steps (or the distance of the bullet). (newX# = camera position x() etc.)
move the camera back 3000 steps so it ends up in it's original position.

now check if the line you created collided with something:
collide_with_object = intersectObject( x#, y#, z#, newx#, newy#, newz# )
if collide_with_object= true
get normal and position
apply force to "collide_with_object" object
endif

i don't have DarkPhysics here at work, so i am not sure about the commands to use. however, this pseudo would get you on the right track.

bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 9th Oct 2006 22:14
look up the ccd commands...i believe it is short for continous collision detection.

Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 10th Oct 2006 05:09 Edited at: 10th Oct 2006 05:09
CCD is not currently implemented. The command is there to turn it on but the command to assign it to the individual bullets

phy set rigid body continuous cd BulletID, 1

does not work. We will have to wait for the next update i guess

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 10th Oct 2006 06:02 Edited at: 10th Oct 2006 06:13
ahh sorry i thought that was fixed with the last update my bad.

Lukas w's concept is right except the fact of finding the normal to apply the force. If you found the normal and used that to calculate the force then the object would always fly in opposite direction of that face...just applying a force to the object at that specific spot in the direction the shot traveled would be best.

for example if you shot a sphere on your left, by first applying a force according to normals the sphere would bullet to the right without any spin because on a sphere all normals would point directly to the center. but by applying it acoording to the direction of the traveling bullet it would still kick to right...just not as sharp and some spin would be added too.

Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 10th Oct 2006 10:37
Here's an example of how to use CCD:

ESP
17
Years of Service
User Offline
Joined: 2nd Aug 2006
Location: London, England, U.K.
Posted: 10th Oct 2006 12:29
Hi Mike,

are we to believe that CCD is now working?

The 'phy set rigid body ccd 101, 1' commands are not highlighted in the editor, but the program does compile.

Robin
Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 10th Oct 2006 12:45
The commands are in and working but the keywords file has not been updated. I will update the keywords file for the next release.

Login to post a reply

Server time is: 2024-03-28 09:37:06
Your offset time is: 2024-03-28 09:37:06