Jump to content
h4wek

Error in script logic checking values

Recommended Posts

I have script for mount cargo to vehicles and to discover loaded stuff orientation in vehicle I use vector up and dir values so I was suprised when one of my functions start to work non logic:

 

_obj_dimensions = {params ["_object"];
    _c1 = (boundingBoxReal _object)#0;_c2 = (boundingBoxReal _object)#1;
    _X = abs ((_c2 select 0) - (_c1 select 0));
    _Y = abs ((_c2 select 1) - (_c1 select 1));
    _H = abs ((_c2 select 2) - (_c1 select 2));
    _objsize = [_X,_Y,_H]; _org = [_X,_Y,_H];
    if !(isnull attachedTo _object) then {
        _holder = attachedTo _object;
        //if (((_holder vectorWorldToModelVisual (vectorUpVisual _object))#2) == 1) then {_objsize = [_X,_Y,_H]};
        systemchat format ["dir %1",((_holder vectorWorldToModelVisual (vectorDirVisual _object))#0)];
        if ((((_holder vectorWorldToModelVisual (vectorDirVisual _object))#0) == 1) || (((_holder vectorWorldToModelVisual (vectorDirVisual _object))#0) == -1)) then {_objsize = [_Y,_X,_H]};
        if (((_holder vectorWorldToModelVisual (vectorUpVisual _object))#1) == 1) then {_objsize = [_X,_H,_Y]};
        if (((_holder vectorWorldToModelVisual (vectorUpVisual _object))#0) == 1) then {_objsize = [_H,_Y,_X]};
        systemchat format ["obj connected %1 - %2 - org: %3",_objsize, (_holder vectorWorldToModelVisual (vectorDirVisual _object)),_org];
    };
_objsize
};

 

Marked line not react always to value what is checking (i have on system chat returned value -1 and marked line not react on it - did I make something wrong? beacouse it sometimes work sometimes not - i am confused. Below screens from few seconds divided readings of the same script logic.

 

?imw=5000&imh=5000&ima=fit&impolicy=Lett what the f.....??!! ?imw=5000&imh=5000&ima=fit&impolicy=Lett

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

×