|
| 08 May 2016 11:37 AM |
| Alright since my last post was worded terribly I am trying to make a laser pointer using ray casting, so when it is turned on it creates a ray that extends til it finds a part then it creates a part that extends to where it made contact, I am very new to raycasting so I am looking for some help! I don't want it to use mouse.hit like raycasting guns but just straight from the brick, thanks a ton in advance! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
RobuxLife
|
  |
| Joined: 19 Sep 2012 |
| Total Posts: 13336 |
|
|
| 08 May 2016 01:20 PM |
I want to know this also. Just check and see if the ray touches a part?
|
|
|
| Report Abuse |
|
|
|
| 08 May 2016 01:24 PM |
| Yeah I know that part I just wanna know how to calculate the magnitude and stuff and create a brick that extends from the brick to the part the ray touched. |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 May 2016 03:40 PM |
Here's the wiki page you're looking for:
http://wiki.roblox.com/index.php?title=Making_a_ray-casting_laser_gun |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 03:51 PM |
| Yes but that uses mouse.Hit, how would I make the ray come straight from the brick? |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 03:53 PM |
Cast a ray from the brick to the player as soon as it hits the brick.
~~~Da siggy is OP~~~ |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 03:54 PM |
Oh straight from... wouldn't you just change the values you cast the ray from being the head and the brick?
~~~Da siggy is OP~~~ |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 03:58 PM |
| I guess I didn't word it right I want to have a script in a brick, not a tool. I am trying to figure out how I would make like a laser that comes from a brick and extends until it touches a brick, thanks. |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 04:14 PM |
I have this script i've been tinkering with but I need to make it so the ray only comes out of the front of the brick and doesnt change when the brick is moved, thanks
while wait() do local ray = Ray.new(script.Parent.CFrame.p, (script.Parent.CFrame.p).unit * 512) local part, position = workspace:FindPartOnRay(ray) local beam = script.Parent.Beam beam.BrickColor = BrickColor.new("Bright red") beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = false local distance = (script.Parent.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(script.Parent.CFrame.p,position) * CFrame.new(0, 0, -distance / 2) end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 08 May 2016 05:43 PM |
| raycast has a start and end point |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 May 2016 05:52 PM |
It takes Vector3 Values. Vector3 values are given by a part's position or a location on map. |
|
|
| Report Abuse |
|
|