AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Multiple BeamRingPoints (https://forums.alliedmods.net/showthread.php?t=318046)

Minfas 08-10-2019 17:07

Multiple BeamRingPoints
 
Hello community,
Is there any way to create multiple TE_SetupBeamRingPoint above each other?

My Code:
Spoiler


What I want is create something like cone from circles.
Thanks for any help!

TheDS1337 08-10-2019 18:40

Re: Multiple BeamRingPoints
 
You can do it of course, however you'll have to do something like this:
PHP Code:

        float pos[3];
        
pos[0] = g_fMakerPos[marker][0];
        
pos[1] = g_fMakerPos[marker][1];
        
pos[2] = g_fMakerPos[marker][2];

        
TE_SetupBeamRingPoint(pos150.0150.0+0.1g_iBeamSpriteg_iHaloSprite0101.01.20.0colors100); 
        
TE_SendToAll();

        
pos[2] += 10.0

        TE_SetupBeamRingPoint
(pos100.0100.0+0.1g_iBeamSpriteg_iHaloSprite0101.01.20.0colors100); 
        
TE_SendToAll();

        
pos[2] += 10.0

        TE_SetupBeamRingPoint
(pos75.075.0+0.1g_iBeamSpriteg_iHaloSprite0101.01.20.0colors100); 
        
TE_SendToAll();

        
etc........... 


Notice that the ring ending point is changing each time too, this is just to say...

You can use a linear relation between the variation z and radius r (there's only two constant "a" and "b" between them, and you can give it a value of your needs).

Like:
Code:

    r(z) = a * z + b

    a = delta r / delta z
    b = r(0)

Example: let's reuse the previous code

Our cone is going to start from Z = 0.0 to Z = 100.0; and R changes from 0 to 150 so a = (150 - 0) / (0.0 - 100.0) = -1.5; b = r(z = 0) = 150.0 so that r = -1.5z + 150.0

PHP Code:

        float pos[3];
        
pos[0] = g_fMakerPos[marker][0];
        
pos[1] = g_fMakerPos[marker][1];
        
pos[2] = g_fMakerPos[marker][2];

        
float z 0.00.0;

        while( 
100.0f )
        {
                
+= 20.0;
                
pos[2] += z;
                
= -1.5 150.0;
                
                
TE_SetupBeamRingPoint(posrr+0.1g_iBeamSpriteg_iHaloSprite0101.01.20.0colors100); 
                
TE_SendToAll(); 
        } 


Minfas 08-11-2019 08:19

Re: Multiple BeamRingPoints
 
It's working.
Thank you for your help! :)


All times are GMT -4. The time now is 08:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.