Yet another collision problem :-(

Blitz3D Forums/Blitz3D Programming/Yet another collision problem :-(

Idaho Razor(Posted 2004) [#1]
Okay guys i've ran through the tutorial countless times trying to figure out what the heck is wrong and why there is no collision detection... This is the second collision problem i had, the other one was fixed (by luck)...I really need some help to figure out what i am doing wrong, i'd post a snippet of my code but i have no clue where the bug is so here it is:

www.razor.together4eva.com/SpaceInvader3D.zip

Problem: Cannot get enemy bullet to collide with player (hiddencube) hit 4 on the numpad to see the "hiddencube"... I'm trying to delete the enemy bullet type (the one he just hit you with) and the player bullet type (so you cannot fire back after your dead)... i'm also trying to get rid of the guns (freeentity player, freeentity player2)

The collision information is being held in the UpdatePlayer() function, on Row 93...

Please i really need help figuring out my collision bug... I also need to know what i did so i can prevent this bug in the future....

Thanks again for your help!


jfk EO-11110(Posted 2004) [#2]
I can't test it right now, but I wanted to mention: when you hide the cube using HideEntity then the Collision is deactivated for that mesh. use entityalpha 0 instead. And additionally: when both meshes are moving towards eachother, the collision may be missed, you maybe would need to set an Updateworld(0) in between the two movement commands.


Idaho Razor(Posted 2004) [#3]
There was no need to hide the entity because the faces are facing the other way (the player is in the cube) so you can't see the cube unless the faces are flipped...

i'll try that updateworld(0) in between the two movement commands now!


Ross C(Posted 2004) [#4]
I'd also like to add that if the two entities are moving and your detecting collisions between the two, then, as jfk says, is has a good chance of not being detected. Blitz collision system is build for moving to stationary entities.

Try and use the entitydistance command to detect the collision if the two entites are moving. You won't get a collisions response though, just check to see if entity A is close to entity B. Hope that helps :o)


Idaho Razor(Posted 2004) [#5]
Okay after some playing with it and getting help from other blitz3D guys, i finally figured out my problems...

1. i had Collision 4,5,3,1
where 4 was my cube and 5 was my bullet, so i was basically saying my box was a sphere and my bullet was a box...

2. my guns were not set to global, So when i finally got the entitycollided() command to work.. the game wouldn't launch because it said entity did not exist...

3. Once i put a if player <> 0 or player2 <> 0 i had more errors in the main loop i was required to fix... also had some bugs for example you could shoot while the player was dead... had to fix those

4. The guns weren't hiding when they were hit, i had to add hideentity to get rid of em...

Now my collisions are working once again! thanks for your help!