Collisions That Don't Stop or Slide
Blitz3D Forums/Blitz3D Programming/Collisions That Don't Stop or Slide
| ||
I'm writing a 2d in 3d shooter (arent' we all :-) and until now I've been using my own collision based purely on the distance between sprites, and it's been working fine. However, for some reason I though I'd try changing it to use Blitz built-in collision handling. My experiments show that it should work really well apart from the fact that the only collision reactions you seem to have are stop or slide. I don't really want the player's ship stopping when it hits a powerup, or an enemy ship stopping 'cos a piddly little bullet has hit it, so is there any way of detecting the collision but allowing the entities to continue moving? |
| ||
I've been wondering about this too. However, if you delete the powerup or bullet on impact, it works fine. |
| ||
You can use entitydistance. It works just like standard collisions with entityradius but no responce. Also there is another comand but the docs say its slow. Its called MeshesIntersect (mesh_a,mesh_b ) oops, your using sprites, so the MeshesIntersect won't work here. For powerup.powercrystal = Each powercrystal If powerup<>Null pow_del=0 For p_ship.player = Each player If EntityDistance (p_ship\p_pivot,powerup\mesh)<15 Then pow_del=1 EndIf Next If pow_del=1 Then p_alpha#=.5 FreeEntity powerup\mesh Delete powerup pow_del=0 EndIf EndIf Next |
| ||
Cool. EntityDistance seemed a bit ... dodgy - but I hadn't tried combining it with EntityRadius - I'll give that a shot. |
| ||
only collision reactions you seem to have are stop or slide. Yup. Those are your choices with built-in collisions: http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Collisions&ref=3d_cat |
| ||
RiverRatt: That's pretty much exactly what I'm doing at the moment except I've been using my own distance calculating routine. I've changed it to use EntityDistance instead and it's still working fine. The reason I fancied trying collisions is that it copes nicely when the delta timing stutters when sprites move past each other in a single frame. But the stopping behaviour doesn't allow for the way I've done the players bullets (if an enemy is weak enough, a bullet can destroy them and then continue). I'll just stick with EntityDistance for now and maybe limit the maximum frame duration to 100 milliseconds. Mustang: Yes, thank you. |