Creating a circle of objects
#7

floatsin returns sine of an angle (which is a float), whereas asin is an inverse function of sine (sine^-1). For example:

floatsin(60, degrees) ~ 0.866,
asin(0.866) ~ 60°.



This creates a specific number or objects equally distributed around a point.
pawn Код:
stock CreateCircleAroundpoint(objectid, Float:x, Float:y, Float:z, Float:radius, OBJECT_NUMBER)
{
    new Float:x2, Float:y2, Float:angle = 360/(OBJECT_NUMBER), Float:a = 0.0;
    for(new i=0; i<OBJECT_NUMBER; i++)
    {
        printf("%f",a);
        x2 = x + floatcos(a,degrees) * radius;
        y2 = y + floatsin(a,degrees) * radius;
        a += angle;
        CreateObject(objectid, x2, y2, z, 0.0,0.0,0.0);
    }
}
Reply


Messages In This Thread
Creating a circle of objects - by [XST]O_x - 21.07.2013, 16:55
Re: Creating a circle of objects - by Bakr - 21.07.2013, 17:38
Re: Creating a circle of objects - by [XST]O_x - 21.07.2013, 18:14
Re: Creating a circle of objects - by MP2 - 21.07.2013, 18:24
Re: Creating a circle of objects - by Bakr - 21.07.2013, 18:35
Re: Creating a circle of objects - by [XST]O_x - 21.07.2013, 19:51
Re: Creating a circle of objects - by Antonio144 - 21.07.2013, 20:25
Re: Creating a circle of objects - by Pottus - 21.07.2013, 22:21
Re: Creating a circle of objects - by [XST]O_x - 22.07.2013, 04:07
Re: Creating a circle of objects - by Kar - 22.07.2013, 04:54

Forum Jump:


Users browsing this thread: 1 Guest(s)