Point of sphere
#1

Hello,
I want to create firework sphere with objects, but the positions are wrong (objects looks like letter U).
I was searching for solution on many forums (how to calculate point), but nothing came of it. Somebody knows how to do it?

My code:
Код:
new Float:x, Float:y, Float:z, Float:x1, Float:y1, Float:z1;
    GetDynamicObjectPos(objectid, x, y, z);
    CreateExplosion(x,y,z, 11,1.0);
    if(Flare[objectid] == 1)
    {
        Flare[objectid]=0;
        new id;
        new Float:r=3.0;
        for(new i = 0, Float:theta = 1.0, Float:phi = 0.0; i < 4; i ++)
        {
            for(new a=0; a<3;a++)
            {
                id = CreateDynamicObject(19283, x1, y1, z1, 0.0, 0.0, 0.0);
                x1 = x+(r*floatcos(phi, degrees)*floatsin(theta));
                y1 = y+(r*floatsin(phi, degrees)*floatsin(theta));
                z1 = z+(r*floatcos(theta, degrees));
                MoveDynamicObject(id, x1, y1, z1, 4.0);
                phi+=30;
                if(phi == 31) phi=30;
                if(phi == 90) phi=89;
            }
            for(new a=0; a<3;a++)
            {
                id = CreateDynamicObject(19283, x1, y1, z1, 0.0, 0.0, 0.0);
                x1 = x-(r*floatcos(phi, degrees)*floatsin(theta));
                y1 = y-(r*floatsin(phi, degrees)*floatsin(theta));
                z1 = z+(r*floatcos(theta, degrees));
                MoveDynamicObject(id, x1, y1, z1, 4.0);
            }
            theta+=30;
            if(theta==31) theta=30;
            if(theta==90) theta=89;
        }
        DestroyDynamicObject(objectid);
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)