Raised This Month: $18 Target: $400
 4% 

[INC] Beam Entities


Post New Thread Reply   
 
Thread Tools Display Modes
bibu
Veteran Member
Join Date: Sep 2010
Old 05-04-2013 , 19:38   Re: [INC] Beam Entities
Reply With Quote #31

joropito?
__________________
Accepting paid work for clans and communities. !Plugins & Models!
Don't hesitate to contact me.
bibu is offline
TheKidz
Senior Member
Join Date: May 2009
Old 06-08-2013 , 23:52   Re: [INC] Beam Entities
Reply With Quote #32

Is there any way to check beam's touch?
__________________
TheKidz is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 03-08-2014 , 05:25   Re: [INC] Beam Entities
Reply With Quote #33

Quote:
Originally Posted by TheKidz View Post
Is there any way to check beam's touch?
By making an invisible 'wall' in it, yh
__________________
Retired.
Xalus is online now
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 10-17-2015 , 22:57   Re: [INC] Beam Entities
Reply With Quote #34

Not sure if it is a bug or not, but in yokomo's New Tripmine plugin, if the beam intersects with a door(open or not, doesn't matter), it doesn't trigger anymore.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
KORD_12.7
Senior Member
Join Date: Aug 2009
Location: Russia, Vladivostok
Old 10-18-2015 , 04:26   Re: [INC] Beam Entities
Reply With Quote #35

It's not related to this include, problem in yokomo's New Tripmine plugin for sure.
__________________

Vi Veri Veniversum Vivus Vici
Russian Half-Life and Adrenaline Gamer community
KORD_12.7 is offline
Send a message via ICQ to KORD_12.7
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 10-18-2015 , 11:46   Re: [INC] Beam Entities
Reply With Quote #36

How sure are you? Because it's the beam that isn't tripping the explosion. Something like it doesn't register the touch between the player and itself.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 07-11-2017 , 13:40   Re: [INC] Beam Entities
Reply With Quote #37

I'm trying to use this stock to create a beam and register_touch with player.
It works fine if the beam is created parallel to two axis (i.e. X and Y, X and Z or Y and Z).
However if the beam is only parallel to one or no axis, touch is trigger anywhere within a box between the start and end points and not only along the beam (see image).
P.S. The beam is drawn correctly for all cases.

Spoiler


I've narrowed down to mins maxs and set_size being what causes this, which are called in Beam_RelinkBeam.
I'm guessing Half-Life (Counter-Strike) only creates block entities aligned with the X Y Z axis.
If so I'm not sure if there is a way to fix this, does anyone have any idea?


Edit: Can be fixed by checking with tracelines inside touch function whether the player is intercepting where the beam should be.
However touch hooks are called every frame if player continuously touches beam, not sure how much it would slow the server down.
Still interested in an easier fix if anyone knows how.

Spoiler

Last edited by vitorrossi; 07-11-2017 at 16:59.
vitorrossi is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 07-19-2017 , 18:41   Re: [INC] Beam Entities
Reply With Quote #38

This might be a helpful alternative:
PHP Code:
 stock get_distance_to_line(Float:pos_start[3], Float:pos_end[3], Float:pos_object[3])  
 {  
//credits to KoST
    
new Float:vec_start_end[3], Float:vec_start_object[3], Float:vec_end_object[3], Float:vec_end_start[3]
    
xs_vec_sub(pos_endpos_startvec_start_end)         // vector from start to end 
    
xs_vec_sub(pos_objectpos_startvec_start_object)     // vector from end to object 
    
xs_vec_sub(pos_startpos_endvec_end_start)         // vector from end to start 
    
xs_vec_sub(pos_endpos_objectvec_end_object)         // vector object to end 

    
new Float:len_start_object getVecLen(vec_start_object
    new 
Float:angle_start floatacos(xs_vec_dot(vec_start_endvec_start_object) / (getVecLen(vec_start_end) * len_start_object), degrees)  
    new 
Float:angle_end floatacos(xs_vec_dot(vec_end_startvec_end_object) / (getVecLen(vec_end_start) * getVecLen(vec_end_object)), degrees)  

    if(
angle_start <= 90.0 && angle_end <= 90.0
        return 
floatround(len_start_object floatsin(angle_startdegrees)) 
    return -
1  
 

SourcePawn version


Instead of using touch, use a loop to check if players are within distance.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 07-21-2017 , 15:39   Re: [INC] Beam Entities
Reply With Quote #39

Spoiler


This is a great alternative, especially when only using one beam.
However you need to be careful if using this with multiple beams, i.e. if you have 10 beams and 10 players, you'd have to call this stock 100 times.

Last edited by vitorrossi; 07-21-2017 at 15:40.
vitorrossi is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-21-2018 , 20:44   Re: [INC] Beam Entities
Reply With Quote #40

Could someone give a example of how to create a beam with this include?
__________________
EFFx is offline
Send a message via Skype™ to EFFx
Reply


Thread Tools
Display Modes

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 12:19.


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