entity distance function/find

Blitz3D Forums/Blitz3D Beginners Area/entity distance function/find

gerald(Posted 2012) [#1]
Hi,

How is the entitydistance#(entitysource,entityobject) function correctly used?

Is there reference examples for it?

I get array out of bounds errors and can't get it to work.

How else could I find out when I enter the area of an entity to initiate an exchange/interaction?

Gerald


Yue(Posted 2012) [#2]
Hey...
	If EntityDistance (Camera%,Player%) < 50  
           Print "u-U-U-u-u-U!" ; Alarm
           else
           Print "Alarm OFF"  
        End if 


;)
Last edited 2012

Last edited 2012


Zethrax(Posted 2012) [#3]
You just provide the EntityDistance function with the valid entity handles of two entities you want to find the distance between and that distance is returned by the function as a floating point value.

distance_between_entities# = EntityDistance( entity_1_handle, entity_2_handle )

If you're getting array out of bounds errors from running that code then I'm left scratching my head wondering what the hell you're actually doing there. Are you sure you don't have an array named 'EntityDistance' which is overriding the blitz command?

Also take a look at my Triggerplate and OBB code (links below) in the code archives for doing what you're trying to achieve there.

http://www.blitzbasic.com/codearcs/codearcs.php?code=1901

http://www.blitzbasic.com/codearcs/codearcs.php?code=1920