Jump to content
battleship

How to check vertical distance?

Recommended Posts

How should one check vertical distance between two objects? For example a helicopter flying at a certain height and an invisible H placed on LHD or any structure at a certain height. Currently (https://community.bistudio.com/wiki/distance) distance only detects horizontal distance between two objects.

Share this post


Link to post
Share on other sites

This is wrong. distance measures the 3D distance if I pass 3D vectors or just objects to it.

If you just need the z difference between 2 objects then just differentiate the z values of both position vectors

sent from mobile using Tapatalk

Share this post


Link to post
Share on other sites
On 28/4/2017 at 7:34 PM, battleship said:

How should one check vertical distance between two objects? For example a helicopter flying at a certain height and an invisible H placed on LHD or any structure at a certain height. Currently (https://community.bistudio.com/wiki/distance) distance only detects horizontal distance between two objects.

 

Maybe using something like this?: Not tested but my mind just make that crap :D

You could make a trigger for the test. I'm sure it doesn't work but it's an idea. "Distance" command is a mysterious a great mysterious...

 

nul = [Object1, Object2] execVM "Distance.sqf";

 

_Obj1= _this select 0;
_Obj2= _this select 1;

_XObj1 = (getposATL vehicle _Obj1 select 0);
_XObj2 = (getposATL vehicle _Obj2 select 0);

_YObj1 = (getposATL vehicle _Obj1 select 1);
_YObj2 = (getposATL vehicle _Obj2 select 1);

_ZObj1= (getposATL vehicle _Obj1 select 2);
_ZObj2= (getposATL vehicle _Obj2 select 2);


...

if (((_XObj1 distance _XObj2) < 10) && {(_YObj1 distance _YObj2) < 10} && {(_ZObj1 distance _ZObj2) < 30}) then
{
	Hint "The Object1 is 10 meters [x,y] ,but 30 meters [z] close to Object2";
};

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×