Data Realms Fan Forums
http://45.55.195.193/

Laser Pointer
http://45.55.195.193/viewtopic.php?f=1&t=25654
Page 1 of 1

Author:  XavierStudios [ Sun Sep 25, 2011 8:20 pm ]
Post subject:  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

Author:  Shook [ Sun Sep 25, 2011 10:26 pm ]
Post subject:  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.

Author:  XavierStudios [ Sun Sep 25, 2011 10:48 pm ]
Post subject:  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?

Author:  Grif [ Mon Sep 26, 2011 6:42 am ]
Post subject:  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.

Author:  Shook [ Mon Sep 26, 2011 1:09 pm ]
Post subject:  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 194 times

Author:  XavierStudios [ Mon Sep 26, 2011 1:38 pm ]
Post subject:  Re: Laser Pointer

Thank you, Grif and Shook. You both have been helpful.

Author:  danielpower [ Tue Sep 27, 2011 2:44 pm ]
Post subject:  Re: Laser Pointer

Thanks for your tips,very helpful.And a real 100mw laser pointeris also very interesting.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/