I cannot figure out how to make bullets (physical bullets, not rays) actually do damage to the enemy (in a first-person shooter). I have tried the collision sensor but I cant seem to make it work.
All I am trying to do is make it so when the bullet hits the enemy, then the enemy disappears (Edit Object: End Object Actuator). The enemy has the physic type: Character
and the bullet has the physics type: Static
. I am using simple motion for the bullet.
What kind of properties does the bullet of enemy need if any? What should the logic bricks look like?
2 Answers
Your problem might be that the character is not detecting the collision from a static object. If you make your bullet a rigid body object, with all of the translations locked (rotation and location along X,Y, and Z) as in this picture,
Your bullet will have the same behavior as a static object (It will not fall due to gravity and it will not bounce off of other objects), but the rigid body type can detect collisions with a static object. Another thing you could try is changing the collision bounds on both your character and the bullet to something closer to it's actual shape. Normally, a box will work for the projectile, but for the character you will want something more precise such as a Triangle Mesh
-
$\begingroup$ Thank you! the only problem is that when I change it to triangle mesh and I press P it stays for half a second and than blender crashes. It works though you probably don't know why it is crashing $\endgroup$ Commented Jan 5, 2015 at 23:42
Here is what I do for my games. On each enemy you want to setup the following: This checks for a collision with the material "Bullet", which would be the material assigned to your projectile. When it detects that collision it will take 10 LF(Life) of of the object. The second row of bricks tells it that when LF=0 the object should end.
You can change the LF in the properties (hit N), and you can change the damage of the bullet in the bricks.