Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Dec 2016 12:36 AM |
I've got a part, and I'd like to make a ray that stretches for 300 studs off its front face
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Dec 2016 12:37 AM |
Ray.new( part.CFrame * Vector3.new(0, 0, -part.Size.Z/2), -- make the origin the center of the frontface part.CFrame.lookVector * 300 -- extend 300 stusd ) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Dec 2016 12:55 AM |
Right, lookvector.
What is lookvector doing, on a deeper level?
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Dec 2016 12:56 AM |
Also is there any noticeable reason for this unwanted blinking?
/06f2ecdfa791753fcda9ce02b408057d
local beam = Instance.new("Part") beam.Material = Enum.Material.Neon beam.Transparency = .7 beam.Anchored = true beam.CanCollide = false
tool.Equipped:connect(function() rs:BindToRenderStep("BeforeCamera",Enum.RenderPriority.Camera.Value-1,function() if laser then local ray = Ray.new(tool.Laser.CFrame.p,tool.Laser.CFrame.lookVector*300) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local distance = (tool.Laser.CFrame.p-position).magnitude beam.Size = Vector3.new(.3,.3,distance) beam.CFrame = CFrame.new(tool.Laser.CFrame.p,position)*CFrame.new(0,0,-distance/2) beam.Parent = workspace else beam.Parent = nil end end)
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Dec 2016 01:15 AM |
"What is lookvector doing, on a deeper level?" Realistically it's as simple as constructing a Vector3 using the 6th, 9th, and 12th values of the CFrame and negating it. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Dec 2016 01:38 AM |
Here this might help: http://devforum.roblox.com/t/how-to-think-about-cframes/11743/6 https://www.roblox.com/games/102529487/Free-tuff |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2016 01:55 AM |
| well I'm follow this thread. Good stuff thx cntkillme |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
| |
|