View unanswered posts | View active topics It is currently Mon Dec 30, 2024 11:55 pm



Reply to topic  [ 7 posts ] 
 Laser Pointer 
Author Message
User avatar

Joined: Tue Feb 08, 2011 4:14 am
Posts: 59
Reply with quote
Post Laser Pointer
Could anyone link me to an easy-to-implement laser pointer system? I'd rather not hack at Darkstorm or S.A.W. to get a proper laser pointer.

Bonus points if the laser can be toggled on and off using the PIE Menu.

Thanks in advance.
Xavier Studios


Sun Sep 25, 2011 8:20 pm
Profile
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post Re: Laser Pointer
Here ya go, freshly adapted from my own stuff. If neither of us screwed up too badly, it should look like this:

Image

Comments are added, so be sure to check the files. Yes, pie slices are in there too, but they're optional. Everyone's welcome to use this if they need a laser sight really badly.

Edit: Check down below for the download. Somehow it's gone from this post.


Last edited by Shook on Tue Sep 27, 2011 4:32 pm, edited 1 time in total.



Sun Sep 25, 2011 10:26 pm
Profile WWW
User avatar

Joined: Tue Feb 08, 2011 4:14 am
Posts: 59
Reply with quote
Post Re: Laser Pointer
Shook wrote:
Here ya go, freshly adapted from my own stuff. If neither of us screwed up too badly, it should look like this:

Comments are added, so be sure to check the files. Yes, pie slices are in there too, but they're optional. Everyone's welcome to use this if they need a laser sight really badly.


Thank you very much, good sir. I'll test it out.

In Laser.lua, would the
local newPos = Vector(0,0)
on line 12 be what I change if I didn't want the laser to emit from the barrel? Just change the 0,0 to 0,3?


Sun Sep 25, 2011 10:48 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Laser Pointer
Negative. To move the initial point of the beam, change line 10 of Laser.lua:
Code:
local initPos = self.MuzzlePos;


Make it:
Code:
local initPos = Vector(self.MuzzlePos.X,self.MuzzlePos.Y);
and then to change it just do:

Code:
local initPos = Vector(self.MuzzlePos.X,self.MuzzlePos.Y + 3);


Also a quick note, the self.pixelRatio variable currently in the script doesn't actually do anything. Not a huge deal, but if you want to modify it it would take slightly more work.


Mon Sep 26, 2011 6:42 am
Profile
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post Re: Laser Pointer
Yargh, good thing there's someone who pays more attention than i do. I was kinda tired and in a rush yesterday, so i present you the slightly more functional version here. The pixel ratio variable works now, and it also supports origins at the muzzle or gun center (whichever is more convenient for you, it can be switched in the script very easily), along with offsets (plus the script is actually shorter now). I've tested it thoroughly this time, so hopefully it works as expected. :-o

As another benefit, i found out how extremely useful the GetXFlipped function for vectors is. Should've known that one before.


Attachments:
LaserPointer.rar [4.1 KiB]
Downloaded 196 times
Mon Sep 26, 2011 1:09 pm
Profile WWW
User avatar

Joined: Tue Feb 08, 2011 4:14 am
Posts: 59
Reply with quote
Post Re: Laser Pointer
Thank you, Grif and Shook. You both have been helpful.


Mon Sep 26, 2011 1:38 pm
Profile

Joined: Tue Sep 27, 2011 2:39 pm
Posts: 1
Reply with quote
Post Re: Laser Pointer
Thanks for your tips,very helpful.And a real 100mw laser pointeris also very interesting.


Tue Sep 27, 2011 2:44 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.059s | 16 Queries | GZIP : Off ]