How to get the name of an collided entity ?
Blitz3D Forums/Blitz3D Programming/How to get the name of an collided entity ?
| ||
Hi there, I've tried this code : EntityName( EntityCollided (player,2) ) But it cause a memory acces violation. Have you à solution ? |
| ||
Turn Debug Enabled on (Program->Debug Enabled) With this enabled, the errors are more specific. When there is no collision, EntityCollided() will be zero. Using EntityName$(0) will give a 'entity does not exist' error. The solution would be checking EntityCollided first: If EntityCollided(player, 2) then After that, use For i = 1 to CountCollisions(player) mesh = CollidedEntity(player, i) Then you get all the entities that collided. To get their names, use EntityName$(mesh) |