Raised This Month: $ Target: $400
 0% 

Calculating circular origin?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
XSlayer
Member
Join Date: Dec 2021
Old 05-17-2022 , 03:56   Re: Calculating circular origin?
Reply With Quote #2

Quote:
Originally Posted by AdrenalinesWrath View Post
hello everyone,

I'm trying to get origins around an origin to create a beam between center and the end of the circle
and I'm not really good at math lol.
for example origin would be {0.0,0.0,0.0} which would be the center, and the distance would be 150.0

so I want to make it start from the top of it, and make it go in circular motion by 360°

any snippet for it?

probably by using floatsin() and floatcos()? I have no idea how to use them

thanks in advance!


Figured it out! here's a lil snippet if anyone needs it:
PHP Code:
stock get_circular_origin(Float:angleFloat:origin[3], Float:radius,Float:COrigin[3])
{
       
COrigin[0] = radius floatcos(angle,degrees);
       
COrigin[1] = origin[1]
       
COrigin[2] = radius floatsin(angle,degrees);

This Can Help u

PHP Code:
new Float:g_vec[3] = {25.00.0, -20.0}
new 
Float:g_deg 0;

public 
fxWindFXClient )
{    
       
set_task(0.05"rotate"Client__"b"1);
 
       
set_task(1.0"fxRestore"Client__"b"1);
}
public 
fxRestoreClient )
{
        
g_vec[0] = 25.0;
        
g_vec[1] = 0.0;
        
g_vec[2] = -20.0;
}
public 
rotate(Client)
{
    new 
Float:xFloat:y
    x 
25*floatcos(g_degdegrees);
    
25*floatsin(g_degdegrees);
    
g_deg += 70;
    
    
display(Client)
    
    
g_vec[0] = x
    g_vec
[1] = y
    g_vec
[2] += 8.0;
}
public 
display(Client)
{
        new 
origin[3];

        
get_user_origin(Clientorigin)

        
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
        
write_byte(TE_SPRITE// TE id
        
write_coord(floatround(g_vec[0] + origin[0]) )
        
write_coord(floatround(g_vec[1] + origin[1]) )
        
write_coord(floatround(g_vec[2] + origin[2]) )
        
write_shortengfuncEngFunc_ModelIndex"sprites/steam1.spr") );
        
write_byte(3// scale
        
write_byte(255// framerate
        
message_end() 

XSlayer is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:23.


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