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

Laser sight woes :P


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
doku
Member
Join Date: May 2009
Old 06-19-2009 , 10:39   Laser sight woes :P
Reply With Quote #1

Ok so I've created a temp entity laser beam from the weapon to the view target which works fine as a laser sight.

However, here's my problem:

I can't find a way to update the beam smoothly, so far I've tried creating a looping timer (limited to 0.1 second update) and OnGameFrame which also doesn't update quick enough. Is it possible to have the beam update more frequently so it remains attached to the weapon and not lagging behind when moving?

Thanks in advance !
doku is offline
Chris-_-
SourceMod Donor
Join Date: Oct 2008
Old 06-19-2009 , 11:47   Re: Laser sight woes :P
Reply With Quote #2

Temp entity doesn't allow you to parent the entity which is AFAIK the only way to make it smooth.
Chris-_- is offline
doku
Member
Join Date: May 2009
Old 06-19-2009 , 11:49   Re: Laser sight woes :P
Reply With Quote #3

Ok, so is their another way to approach this?
doku is offline
TESLA-X4
Senior Member
Join Date: Dec 2008
Location: $Recycle.Bin
Old 06-20-2009 , 01:34   Re: Laser sight woes :P
Reply With Quote #4

Maybe use equivalent entities instead? Env_beam or env_laser in conjunction with an info_target (not sure if that's an edict, if it isn't, SourceMod can't handle it) or some other entity... Try it out in the Hammer Editor to get the hang of how they work before you start coding them in

Good luck
TESLA-X4 is offline
doku
Member
Join Date: May 2009
Old 06-20-2009 , 11:53   Re: Laser sight woes :P
Reply With Quote #5

Ok I've got a bit further.. just one more hurdle . I've managed to create an ent_laser from the player to the players target, this works perfectly. However I need to parent the ent_laser to the client but that needs a target name. How do I get a target name for the client? or better still the clients weapon.


Thanks again for all the help so far!
doku is offline
doku
Member
Join Date: May 2009
Old 06-20-2009 , 18:00   Re: Laser sight woes :P
Reply With Quote #6

Got a bit further with this but reached another stumbling block

The laser entity is targetting an info_target entity which I teleport to the players 'aim' position. At first I had it working by teleporting both the laser entity and the lasers' target ongame frame, which was ok but I really needed to parent it to get both smoother movement and the ability to use model attachments for positioning...


So I managed to parent the laser to the player using :


PHP Code:
new String:steamid[20]
GetClientAuthString(clientsteamidsizeof(steamid))
DispatchKeyValue(client"targetname"steamid)

...................


SetVariantString(steamid)
AcceptEntityInput(laser[client], "SetParent"
Now the laser moves around smoothly with the player, however it no longer points to the target entity.. It seems parenting it has put some sort of offset onto its target position, so instead of pointing directly ahead it points out to the side.

Any suggestions?

Thanks.
doku is offline
TESLA-X4
Senior Member
Join Date: Dec 2008
Location: $Recycle.Bin
Old 06-21-2009 , 05:07   Re: Laser sight woes :P
Reply With Quote #7

Parent the info_target entity to the player as well, it should work now
TESLA-X4 is offline
doku
Member
Join Date: May 2009
Old 06-21-2009 , 07:29   Re: Laser sight woes :P
Reply With Quote #8

nope doesn't work I don't think the target entity can be parented anyway as it will no longer update the aim position, but will stick at the offset which it was attached to the parent... Any other ideas? is this even possible??
doku is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 06-22-2009 , 17:59   Re: Laser sight woes :P
Reply With Quote #9

Well you've made much more progress than I had. I tried to do this at one point, but failed. Don't give up

(Although I didn't have any Dispatch functions when I attempted this )
__________________
Greyscale 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 11:27.


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