Raised This Month: $ Target: $400
 0% 

[TF2] beam problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NC.svtrade
Senior Member
Join Date: Nov 2015
Old 06-08-2019 , 13:53   [TF2] beam problems
Reply With Quote #1

I'm currently planning to port a LG @ Quake Live to TF2...

I made a demo source code
PHP Code:
    if(weapon == iweaponlist[client][WEAPON_LIGHTNING]) {
        
float clpos[3], eyepos[3], clang[3], endpos[3], beampos[3];
        
        
GetClientAbsOrigin(clientclpos);
        
GetClientEyePosition(clienteyepos);
        
GetClientEyeAngles(clientclang);
        
        
GetEndPosition(endposeyeposclangLIGHTNING_LENGTH);
        
Handle hTrace TR_TraceRayFilterEx(eyeposclangMASK_PLAYERSOLIDRayType_InfiniteTraceRayAllAllowclient);  
        if(
TR_DidHit(hTrace)) {
            
TR_GetEndPosition(beamposhTrace);
        }
        
        if(
GetVectorDistance(clposendpos) < GetVectorDistance(clposbeampos)) {
            
beampos[0] = endpos[0];
            
beampos[1] = endpos[1];
            
beampos[2] = endpos[2];
        }
        
        
clpos[2] += 30.0;
        
        if(
GetClientTeam(client) == 2TE_SetupBeamPoints(clposbeamposLaserModelHaloModel0660.0581.51.530.0, {2550255255}, 0);
        if(
GetClientTeam(client) == 3TE_SetupBeamPoints(clposbeamposLaserModelHaloModel0660.0581.51.530.0, {0255255255}, 0);
        
TE_SendToAll();
    }
stock void GetEndPosition(float end[3], float start[3], float angle[3], float distancebool:negative false)
{
    
float vector[3];
    
end[0] = start[0];
    
end[1] = start[1];
    
end[2] = start[2];

    
vector[0] = Cosine(DegToRad(angle[1]));
    
vector[1] = Sine(DegToRad(angle[1]));
    
vector[2] = Sine(DegToRad(angle[0])) * -1.0;
    
NormalizeVector(vectorvector);
    
ScaleVector(vectordistance);

    if(
negativeScaleVector(vector, -1.0);
    
AddVectors(endvectorend);

but the beams can't follow the fire speed..
https://imgur.com/a/8ocy2aT


What forwards or functions should I use to fix this problem?

Last edited by NC.svtrade; 06-08-2019 at 13:54.
NC.svtrade is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 06-08-2019 , 18:33   Re: [TF2] beam problems
Reply With Quote #2

Quote:
Originally Posted by NC.svtrade View Post
I'm currently planning to port a LG @ Quake Live to TF2...

but the beams can't follow the fire speed..
https://imgur.com/a/8ocy2aT
So are you wanting more beams to appear? or are you wanting the older beams to die faster so you only see a single beam?
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline
NC.svtrade
Senior Member
Join Date: Nov 2015
Old 06-08-2019 , 20:12   Re: [TF2] beam problems
Reply With Quote #3

Quote:
Originally Posted by 1337norway View Post
So are you wanting more beams to appear? or are you wanting the older beams to die faster so you only see a single beam?
I wanting the older beams to die faster so I can only see a single beam like
https://www.youtube.com/watch?v=Ca538R_YCtY
NC.svtrade is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 06-08-2019 , 21:09   Re: [TF2] beam problems
Reply With Quote #4

The sixth argument of the TE_SetupBeamPoints function is the life of the drawn effect. You have this set to 0.058, you will want to make this even small to like 0.01, however keep in mind going really low may result in the beam not drawing at all. Also you'd want to call the function more frequently. You can only go as fast as the tick rate of the server so 1.0/128 = 0.0078 or 1.0/64 = 0.015. This also will still probably look choppy and bad, the only way to sustain an effect like that smoothly in the source engine would be to make it into a model and have it attached to the player entity so it rotates with them. However that comes with issues itself as it will still move up and down on the yaw axis really strangely.
__________________
I highly recommend joining the SourceMod Discord Server for real time support.

Last edited by backwards; 06-08-2019 at 21:14.
backwards is offline
NC.svtrade
Senior Member
Join Date: Nov 2015
Old 06-10-2019 , 23:13   Re: [TF2] beam problems
Reply With Quote #5

Quote:
Originally Posted by 1337norway View Post
The sixth argument of the TE_SetupBeamPoints function is the life of the drawn effect. You have this set to 0.058, you will want to make this even small to like 0.01, however keep in mind going really low may result in the beam not drawing at all. Also you'd want to call the function more frequently. You can only go as fast as the tick rate of the server so 1.0/128 = 0.0078 or 1.0/64 = 0.015. This also will still probably look choppy and bad, the only way to sustain an effect like that smoothly in the source engine would be to make it into a model and have it attached to the player entity so it rotates with them. However that comes with issues itself as it will still move up and down on the yaw axis really strangely.
I researched more, but sadly the TE_SetupBeamPoints function's maximum life time is limited above 0.05 seconds. which I think I should use another methods.
NC.svtrade is offline
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 04:20.


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