game engine problem

so i have ob ‘gun’ add ob ‘bullet’ whenever spacebar is pressed. now when buttel hits ob ‘enemy’ i want to remove enemy. I tried using collision detection but it didnt work :-? i have all of the property names right and everything. Why isnt this working?

How big is the bullet?If the bullet is really small and it flies too fast , it will fly through stuff without detecting collision sometimes.Make sure the bullet is bigger or decrease the speed.If this doesnt work then maybe you dont have collision faces aplyed to the enemy or bullet.

how do i apply collision faces?

Go into face mode (F), then editing mode in the buttons window, select the face/s you want to have collision, in the ‘Texture face’ box enable the ‘Collision’ button and then press Copy DrawMode to copy the settings across the faces.

From Daniel

yes collision was already enabled…i just found out that it only detects the collision if the object is on the same layer(i.e not an added object)

Is there a way to fix this?

Thats strange :-? .Its supposed to detect collision from all layers :-? :-? .Maybe you could give us the blend so we could have a look at that problem?

collisions with added objects work in v2.25 - it appears that 2.4 does not have all the functionality as 2.25. where do we submit bug reports?

I made my first game with 2.34 and used the add object thing and it worked perfectly.

i’m using 2.37 for this project… :-?

here i made a sample…doesnt work in this either.

could you tell me what im doing wrong?

If your using 2.37 I would suggest using ray in python.

Its much better then collision in 2.37 I noticed that in the new blenders collision is working better. Hopefully in the new release 2.41 will have good ray and collision support.

here is the ray.txt
you add this to your bullet that is added to the scene from your gun.
the bullet must have sensor named ray, using script (below)
then you have objects (that are hit by bullet) with the property “hit” and when hit=1 you do whatever. I usaly have hp and do hp - 1 and hit reset to 0 so it can be hit again and again. then when hp = 0 then kill the object.

game = GameLogic
cont = game.getCurrentController()
ray = cont.getSensor(“ray”)
endit = cont.getActuator(“end”)
if ray.isPositive():
ob = ray.getHitObject()
if hasattr(ob,“hit”):
ob.hit = 1
if hasattr(ob,“any”):

I figgured out what you can do to make it work.All you have to do is give the bullet a collision sensor, thats all.Everything else is set up the right way.Try it , it works.

heh. You’re a lifesaver Eduard

Why, exactly, is it, that when an object is moving too fast it doesn’t register collisions? Is it just because of the game engine’s, er…, level of being? It doesn’t even have to be going real fast. In my bowling game experiment, the ball doesn’t even hit the pins every time, when it hits them. I can’t imagine making a bullet go so slow. I hope this is fixed in 2.4x

I am not exactly sure, but i THINK its if it is going to fast that the frames will skip it. If you were to watch it in frame-by-frame, then the bullet would never have a frame that is actually colliding with the object. As I said, im not sure, but thats my best guess.

Im glad i could help :smiley: !