Raised This Month: $51 Target: $400
 12% 

Solved Creating a big horizontal circle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 08-18-2018 , 16:42   Creating a big horizontal circle
Reply With Quote #1

Hello, I want to create a big horizontal circle.


TE_SetupBeamRingPoint dont work because is radius limit is 4096.


I have this stocks for a vertical circle but I want to convert it on horizontal circle:
PHP Code:
Circle(Float:vecLocation[3], Float:radius)
{
    new 
Float:angle=0.0Float:xFloat:y;
    
    new 
Float:pos1[3];
    new 
Float:pos2[3];
        
    
//Create the start position for the first part of the beam
    
pos2[0] = vecLocation[0];
    
pos2[1] = vecLocation[1] + radius;
    
pos2[2] = vecLocation[2];
    
    while (
angle <= PI)
    {            
        
radius Cosine(angle);
        
radius Sine(angle);
        
        
pos1[0] = vecLocation[0];
        
pos1[1] = vecLocation[1] + x;
        
pos1[2] = vecLocation[2] + y;

        
TE_SetupBeamPoints(pos1pos2BeamSpriteHaloSprite008.0Float:5.0Float:5.050.0, {255,255,255,255}, 3);
        
TE_SendToAll();
        
        
pos2[0] = pos1[0];
        
pos2[1] = pos1[1];
        
pos2[2] = pos1[2];
        
        
angle += 0.1;
    }


Any help? I will continue testing.


EDIT: Solved.

PHP Code:
void Circle(float vecLocation[3], float radius) {
    
float angle 0.0xy;

    
float pos1[3];
    
float pos2[3];

    
//Create the start position for the first part of the beam
    
pos2[0] = vecLocation[0] + radius;
    
pos2[1] = vecLocation[1];
    
pos2[2] = vecLocation[2];

    while (
angle <= FLOAT_PI) {
        
radius Cosine(angle);
        
radius Sine(angle);

        
pos1[0] = vecLocation[0] + x;
        
pos1[1] = vecLocation[1] + y;
        
pos1[2] = vecLocation[2];

        
TE_SetupBeamPoints(pos1pos2g_spriteg_HaloSprite000.1view_as<float>(5.0), view_as<float>(5.0), 50.0, {25500255}, 3);
        
TE_SendToAll();

        
pos2[0] = pos1[0];
        
pos2[1] = pos1[1];
        
pos2[2] = pos1[2];

        
angle += DegToRad(6.0);
    }

__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 08-18-2018 at 22:52. Reason: solved
Franc1sco is offline
Send a message via MSN to Franc1sco
SHUFEN
Senior Member
Join Date: Jun 2014
Location: Japan, Tokyo
Old 08-18-2018 , 17:14   Re: Creating a big horizontal circle
Reply With Quote #2

Simply

Code:
void HorizontalCircle(float vecLocation[3], float radius) {
	float angle = 0.0, x, y;

	float pos1[3];
	float pos2[3];

	//Create the start position for the first part of the beam
	pos2[0] = vecLocation[0] + radius;
	pos2[1] = vecLocation[1];
	pos2[2] = vecLocation[2];

	while (angle <= 2 * FLOAT_PI) {
		x = radius * Cosine(angle);
		y = radius * Sine(angle);

		pos1[0] = vecLocation[0] + x;
		pos1[1] = vecLocation[1] + y;
		pos1[2] = vecLocation[2];

		TE_SetupBeamPoints(pos1, pos2, g_BeamSprite, g_HaloSprite, 0, 0, 8.0, view_as<float>(5.0), view_as<float>(5.0), 5, 0.0, {255, 255, 255, 255}, 3);
		TE_SendToAll();

		pos2[0] = pos1[0];
		pos2[1] = pos1[1];
		pos2[2] = pos1[2];

		angle += DegToRad(6.0);
	}
}
Code:
public Action TEST_CIR(int client, int args) {
	float pos[3];
	GetClientEyePosition(client, pos);

	ArrayList arr = new ArrayList(3);
	arr.PushArray(pos);
	arr.Push(4096.0);
	CreateTimer(0.1, Timer_ExpensiveBeacon_Reversed, arr, TIMER_REPEAT);

	return Plugin_Handled;
}

public Action Timer_ExpensiveBeacon_Reversed(Handle timer, any arr_) {
	ArrayList arr = view_as<ArrayList>(arr_);
	float pos[3];
	arr.GetArray(0, pos, 3);
	float radius = arr.Get(1);

	if (radius <= 16.0) {
		delete arr;
		return Plugin_Stop;
	}
	HorizontalCircle(pos, radius);
	radius -= 16.0;
	arr.Set(1, radius);

	return Plugin_Continue;
}

Last edited by SHUFEN; 08-18-2018 at 17:58.
SHUFEN is offline
Send a message via Skype™ to SHUFEN
Reply



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:00.


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