generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How to make a ray off a face by 300 studs

Previous Thread :: Next Thread 
Soybeen is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
20 Dec 2016 01:55 AM
well I'm follow this thread. Good stuff thx cntkillme
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
20 Dec 2016 05:20 PM
Yep ty


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image