Jump to content
Sign in to follow this  
Stormmy1950

Position

Recommended Posts

Hi guys so i made a script 3dcompass that only shows in targeting pods and checks the zoom level of targeting pod and adjust the size of the compass. That works great. Only thing that is kinda bothering me is when you are in the plane the compass is going up and down depending on the terrain is there any way i can disable that of going up and down.
Code: https://sqfbin.com/gopivayehubibuwixela

I know i need to add something to this line: _center =  positionCameraToWorld [0,0,3];

Share this post


Link to post
Share on other sites

Bump! Dose anybody have any idea how i could make it so. The draw3d Compass dose not bounce around while flying over uneven terrain ?

Share this post


Link to post
Share on other sites

@Stormmy1950, I fixed the problem, also I rewrote your code:

addMissionEventHandler ["Draw3D", {
    if (!isGameFocused) exitWith { };

    if (!((((vehicle player) isKindOf "Air") || {
        _control = UAVControl (getConnectedUAV player);

        ((_control find player) + 1) == (_control find "GUNNER")
    }) && { cameraView == "Gunner" })) exitWith { };

    _zoomLevel =
        round ((([0.5, 0.5] distance2D (worldToScreen (positionCameraToWorld [0, 3, 4]))) * (getResolution select 5) / 2) * 10) / 10;

    _offsets = switch (true) do { 
        case (_zoomLevel <= 0.5): { [
            [[0, 1, 0], [0, 0.5, 0]],
            [[0, -1, 0], [0, -0.5, 0]],
            [[1, 0, 0], [0.5, 0, 0]],
            [[-1, 0, 0], [-0.5, 0, 0]]
        ] };
        case ((_zoomLevel > 0.5) && { _zoomLevel <= 3 }): { [
            [[0, 0.25, 0], [0, 0.12, 0]],
            [[0, -0.25, 0], [0, -0.12, 0]],
            [[0.25, 0, 0], [0.12, 0, 0]],
            [[-0.25, 0, 0], [-0.12, 0, 0]]
        ] };
        case (_zoomLevel > 3): { [
            [[0, 0.06, 0], [0, 0.03, 0]],
            [[0, -0.06, 0], [0, -0.03, 0]],
            [[0.06, 0, 0], [0.03, 0, 0]],
            [[-0.06, 0, 0], [-0.03, 0, 0]]
        ] };
        default { [] };
    };

    if ((count _offsets) == 0) exitWith { };

    _drawIcon3DArgs = [
        "",
        [],
        [],
        0,
        0,
        0,
        "",
        2,
        0.05,
        "PuristaMedium"
    ];

    _center = AGLToASL (positionCameraToWorld [0, 0, 3]);

    {
        _letter = _x select 0;
        _color = _x select 1;

        _offsetsPair = _offsets select _forEachIndex;

        _drawIcon3DArgs set [1, _color];
        _drawIcon3DArgs set [2, ASLToAGL (_center vectorAdd (_offsetsPair select 0))];
        _drawIcon3DArgs set [6, _letter];

        drawIcon3D _drawIcon3DArgs;

        _drawIcon3DArgs set [2, ASLToAGL (_center vectorAdd (_offsetsPair select 1))];
        _drawIcon3DArgs set [6, "."];

        drawIcon3D _drawIcon3DArgs;
    } forEach [
        ["N", [1, 0.1, 0.1, 1]],
        ["S", [1, 1, 1, 0.7]],
        ["E", [1, 1, 1, 0.7]],
        ["W", [1, 1, 1, 0.7]]
    ];
}];

 

  • 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
Sign in to follow this  

×