Jump to content
redmarstrd

Angles in mission.sqm objects

Recommended Posts

Hello,

 

I have been breaking my head over a certain set of variables in the mission.sqm, generated by the Eden 3D editor. What i am trying to figure out is to what the "angle" array actually has for values. Doesn't seen to be degrees. Maybe radians? I have no idea at the moment. In the editor I have rotation values like x:356.795     y:305.726     z:3.890 . 

 

Here is what i have found in the mission.sqm:

 

class Entities
{
items = 22;
class Item0
{
dataType = "Object";
class PositionInfo
{
position[] = {4904.0103,336.05936,21883.053};
angles[] = {6.227246,5.3359337,0.06789292};     <--------------------
};
side = "Empty";
class Attributes{};
id = 19;
type = "Land_BagBunker_Small_F";
};

What i am trying to do is to extract this information and use "createvehicle" in a script serverside. I gotten as far as extracting the "position" part, but the "angles" part are values that seem to be different from the usual "degrees" that you find in the 3d editor itself. 

 

Does someone have an idea how to convert these angles[] = {6.227246,5.3359337,0.06789292}; values to values that i can use with setVectordir ? Or maybe has a better idea for getting 3D editor information in a servside solution?

 

 

cheers,

 

Redd

Share this post


Link to post
Share on other sites

Apparently it is in radians indeed. I should have seen it when the factor between the degrees and unknown was about 57.3...

Share this post


Link to post
Share on other sites

Hi, did you find a solution to this, i m having some hard time trying to do the same thing.

 

this is what i should see :

39023336c4.png

 

And this is what i got :

beb3470ff6.jpg

 

 

Code used (this comes from the refactored LARS composition spawn script, but instead of composition, it uses mission.sqm) :

        _cfgRot params["_P", "_Y", "_R"];
        _Y = deg _Y;
        _P = deg _P;
        _R = 360 - (deg _R);         
        {
            private _deg = call compile format [ "%1 mod 360", _x ];
            if ( _deg < 0 ) then { _deg = linearConversion[ -0, -360, _deg, 360, 0 ]; };
            call compile format[ "%1 = _deg", _x ];
        } forEach [ "_P", "_R", "_Y" ];        
        if ( _debug ) then { diag_log format["%1 => yawl: %2, pitch: %3, roll: %4", _color, _Y, _P, _R]; };
        private _dir = [sin _Y * cos _P, cos _Y * cos _P, sin _P];
        private _up = [[sin _R, -sin _P, cos _R * cos _P], -_Y] call BIS_fnc_rotateVector2D;
        _obj setVectorDirAndUp [_dir, _up];

debug returned :

17:46:46 "blue => yawl: 180, pitch: 315, roll: 0"
17:46:46 "green => yawl: 0, pitch: 45, roll: 0"
17:46:46 "red => yawl: 270, pitch: 0, roll: 315"
17:46:46 "yellow => yawl: 90, pitch: 0, roll: 45"

 

Share this post


Link to post
Share on other sites

found the solution :

_cfgRot params["_P", "_Y", "_R"];
_Y = deg _Y;
_P = 360 - (deg _P);
_R = 360 - (deg _R);         
{
	private _deg = call compile format [ "%1 mod 360", _x ];
	if ( _deg < 0 ) then { _deg = linearConversion[ -0, -360, _deg, 360, 0 ]; };
	call compile format[ "%1 = _deg", _x ];
} forEach [ "_P", "_R", "_Y" ];        
private _up = [sin _R, -sin _P, cos _R * cos _P];
_obj setDir _Y;
_obj setVectorUp _up;

 

  • Like 2
  • Thanks 1

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

×