Jump to content

Recommended Posts

I don't understand how the rotation works. Specifically I made Airburst Mortar rounds and want to increase the kill zone by rotating the claymores:

this addEventHandler ["Fired",
{
    params ["_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile","_vehicle"];

    nul = [_drone,_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_vehicle] spawn {
        params ["_drone","_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile","_vehicle"];

        waitUntil { sleep 1; getPos _projectile select 2 > 50 };

        while { alive _projectile } do {
            waitUntil { getPos _projectile select 2 < 30 };

            for "_i" from 0 to 3 do {
                _tungsten_fragments = createVehicle ["ClaymoreDirectionalMine_Remote_Ammo", [0,0,1000], [], 0];
                _tungsten_fragments attachTo [_projectile,[0,0,0]];

		_random =round (random 10) / 10;
		_tungsten_fragments setVectorDirAndUp [[0,0,_random], [0,0,_random]];

                _tungsten_fragments setDamage 1;
            };

            deleteVehicle _projectile;
	    sleep 1;
        };
    };
}];

I don't understand which numbers in the setVectorDirAndUp Array I need to change to rotate the claymores and what each number even does .

Share this post


Link to post
Share on other sites

Keep in mind that once you attach an item using attachTo serVectorDirAndUp becomes relative, see the info box on wiki for attachTo

  • Like 2

Share this post


Link to post
Share on other sites
18 hours ago, Heavensrevenger said:

I don't understand how the rotation works. Specifically I made Airburst Mortar rounds and want to increase the kill zone by rotating the claymores:


		_tungsten_fragments setVectorDirAndUp [[0,0,_random], [0,0,_random]];

I don't understand which numbers in the setVectorDirAndUp Array I need to change to rotate the claymores and what each number even does .

 

setVectorDirAndUp

A sure thing: you can't randomize both z parameter inside both vectorDir and vectorUp  because they are linked by geometry (see the "simple" tilt forward 30° in example 5).
If you have an axis for reference, you can work with:
BIS_fnc_transformVectorDirAndUp

see also : BIS_fnc_rotateVector3D

 

  • Like 3

Share this post


Link to post
Share on other sites
18 hours ago, Heavensrevenger said:

_random =round (random 10) / 10;  // NOPE!
_tungsten_fragments setVectorDirAndUp [[0,0,_random], [0,0,_random]];

 

 

Also worth noting that vectors take normalized values, meaning values between 0 and 1. You can think of these as percentages, or values between 0 and 1 (hundred).

  • Like 3

Share this post


Link to post
Share on other sites
7 hours ago, Harzach said:

 

Also worth noting that vectors take normalized values, meaning values between 0 and 1. You can think of these as percentages, or values between 0 and 1 (hundred).

_random should be a number between 0 and 1 if im not mistaken

Share this post


Link to post
Share on other sites
5 hours ago, Heavensrevenger said:

_random should be a number between 0 and 1 if im not mistaken

 

You are not, and I continue to prove my signature correct!

 

Using round will, however, lead to non-uniform results. If you want an even distribution of possible values try floor:

_random = floor (random 11) / 10;

floor (random 11) will give you an even distribution of values from 0 to 10 (see notes at bottom of random page). Divide by 10 and you have single-decimal values from 0 to 1.

  • Like 1

Share this post


Link to post
Share on other sites
19 hours ago, Harzach said:

 

You are not, and I continue to prove my signature correct!+

 

Using round will, however, lead to non-uniform results. If you want an even distribution of possible values try floor:


_random = floor (random 11) / 10;

floor (random 11) will give you an even distribution of values from 0 to 10 (see notes at bottom of random page). Divide by 10 and you have single-decimal values from 0 to 1.


ok that signature is genuinely funny but thank you I didnt even realize I was getting an uneven distribution so that should definitely help

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

×