collisionentity???

Blitz3D Forums/Blitz3D Programming/collisionentity???

Rook Zimbabwe(Posted 2004) [#1]
I am trying to portal to a new level and I though I could use collisionentity to check if the player has collided with the entity... I make this note because the help fil in Blitz3d on this command is a little bit cryptic (also the one on collisionsurface)

Can anyone be a bit more verbose about this command?
-RZ


Zethrax(Posted 2004) [#2]
Normally you'd have all the entity handles of your collidable entities in one or more lists, and sequence through these lists when you want to check collisions for these entities.

For each collision entity, you use 'CountCollisions' to get the number of collisions that it has been involved in. This gives you the range of the entity's collision indexes which are used with various collision commands, and which start at 1.

num_collisions = CountCollisions ( entity_handle )

You then loop through all the collisions that it has been involved in and use 'CollisionEntity' to get the entity handle of the entity collided with.

For collision_index = 1 to num_collisions

the_other_entitys_handle = CollisionEntity ( entity_handle, collision_index )

the_collision_surface = CollisionSurface ( entity_handle, collision_index )

Next

I haven't used 'CollisionSurface' so I'm not sure what the story is there, but if I'm reading the docs correctly the code above should return the handle of the mesh surface on the collision source entity that was closest to the collision point. If the collision source entity was not a mesh then it should return a zero. Try experimenting with the command to see if you can get a clearer idea of how it works.