123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|447|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Blitz collisions trouble

Fri, 22 Aug 2008, 12:25
mindstorm8191
I have come across some problems with Blitz's collisions, and I'm not sure if there's a problem with how I'm doing things, or if the models I'm using just won't work with it. I'm building a spaceship game where you can salvage parts of the enemy ships you destroy to make your ship stronger. With that in mind, I've chosen a very simple ship design, where all the pieces are flat meshes (you can literally attach pieces to your ship). The project has been a long time coming, and I am just now getting to the point where I can fire weapons at another ship. But the collisions between the bullets and the ship is simply not working.

I think the culprit here is that all the ships are flat meshes, and since they have no depth, the bullets are simply skimming by them, but I can't be sure. Its been a while since I've done anything with blitz's collisions, so let me make sure I have this process correct.

1) After calling graphics3d, call 'Collisions bullettype, shiptype, sphere-to-polygon, stop-on-collision.
2) When creating the ships, call EntityType and set them to the ship type, for collisions. Do the same for all parts attached.
3) When creating bullets, call EntityType for them too, and set their EntityRadius to non-zero. (I call this later so that bullet collisions don't hit the ship that fired it, but I'm certain EntityType is being set).
4) To check for collisions, call CountCollisions on the bullet. If its greater than 0, there was a collision with a ship or part. CollisionEntity() will tell you the entity that the bullet collided with.

So is all this the correct way of doing things? If so I think my ships will have to take on a little depth, so that bullets can actually hit them.

-=-=-
Vesuvius web game
Fri, 22 Aug 2008, 19:33
Orion Pax
Yes, your method is correct. But what I would do for your types and bullets is this.

bullet types
your ship type - all parts you pick up change to this type when then get attached
other part type - spare parts that are floating around that you have not picked up
enemy type - your enemies
enemy bullets - and their bullets
and what ever else you got....

at any rate you can change the type after you initially set it. or at least I believe you can, the web site doesnt say you cant and I dont have a blitz3d copy running at the moment. When you pick up a part change it to your ship type and dont associate your bullets with your ship type. Problem solved.

Any ways I think your right in assuming that you need some depth. That MIGHT be it. I would have to actually see some code to tell ya if your method is correct.
Sat, 23 Aug 2008, 14:40
mindstorm8191
thanks orion, I'll see what I can do about adding depth to my models. I'd share my project source but its some 6,000 lines now, and growing!

-=-=-
Vesuvius web game