I have a level and a tank in blender, the tank is supposed to shoot a bullet through the air, and when the bullet hits the wall, it dissapears, but the collision sensor also collides with the tank, so when it shoots, the bullet ends instantly, how to make the bullet only colide with the walls?
Add a property to the walls and put that property in the collision sensor. It will only be positive when it hits an object with that property.
tried that, but the bullet seems to go right through the walls?
The technique proposed by nemitis will work, but is quite unnatural and will become a problem. A grenade is not selective to what it hits with respect to detonating. Try add a delay sensor which is set to “Level” and with a delay long enough for the projectile to leave the nozzle. (You AND this delay sensor with your collision detector, and connect the AND controller to the End Object actuator.)
add the delay where?
u mean one object called bullet_leaving, then a dealy to replace with original bullet?
You should create the bullet outside of the tank ;).
When I was first experimenting with logic bricks (I know how to do it much more seamlessly with python now) I tried many ways to bet bullets to work.
The best I found was to have two kinds of bullets. Each had a different collision sensor.
The player and the enemies also had a unique property which the sensor would check. So bad bullets would kill the player, and good bullets would only kill enemies.
You can also give both bad and good bullets an extra collision sensor to check if they hit a wall.
For the bullet object, created with an Add Object actuator inside the gun:
Collision (Any object) --------- AND -------- End Object
Delay (f=30, Level=True)-----/
That way, for a suitably high delay, “f” the bullet will not trigger the End Object actuator while inside the gun. The delay should, however stay minimal, to ensure the bullet is “fused” shortly after leaving the gun nozzle.
The technique suggested by Monster is easier, more efficient, but a bit unnatural.
set the bullet a dynamic object and use a force in the motion actuator instead of just changing the location