a suggestion

Started by
1 comment, last by Supernat02 16 years, 10 months ago
Hi, I am new to game programming . Trying to develop a small shooting game. I have a doubt in edge detection. Is there any direct way in direct x to detect whether my target has been hit by the bullet from the gun. I render bullet,gun,target as objects and apply them an appropriate 2D texture. Expecting reply.
Advertisement
I would suggest to use some physics engine for that (like Newton, Bullet, ODE...)
and leave DX for things like blood, bullet holes (decals).

Belfegor.
The only D3DX helper function is D3DXIntersect, and it's for testing a ray against a mesh. This is not really much use without doing some goofy work arounds to make that work. The easiest thing is to write the code yourself, it's fairly simple. You can simplify the character and bullet meshes with bounding boxes.

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Dec_2005/D3DXComputeBoundingBox.asp

Then, turn the two min/max points returned by D3DXComputeBoundingBox into actual meshes with 8 points (3D cubes). Each frame, transform the cubes by the same world transform as you do each mesh and test to see if one cube lies in the other. That test is pretty straight forward.

Good luck,
Chris
Chris ByersMicrosoft DirectX MVP - 2005

This topic is closed to new replies.

Advertisement