3D Distance calculation by monotonic6th Feb 2008 16:57
|
---|
Summary This demonstrates how to calculate the distance between points or object positions. Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ObjectPosX# = object position x( obj_num ) ObjectPosY# = object position y( obj_num ) ObjectPosZ# = object position z( obj_num ) Object2PosX# = object position x( obj2_num ) Object2PosY# = object position y( obj2_num ) Object2PosZ# = object position z( obj2_num ) X# = ObjectPosX# - Object2PosX# Y# = ObjectPosY# - Object2PosY# Z# = ObjectPosZ# - Object2PosZ# Distance# = sqrt( (X# ^ 2) + (Y# ^ 2) + (Z# ^ 2 ) ) |