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: RayCasting

Previous Thread :: Next Thread 
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 Jan 2015 07:58 PM
Hey, so I was recently reading about raycasting on the roblox wiki and I don't really understand it. But I do know that it's a methode of detecting if any object is in the way of a part. Could someone explain some functions of raycasting?
Thanks.
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 Jan 2015 08:17 PM
Help please.
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
18 Jan 2015 08:27 PM
Basically getting the object(s) hit within the ray and retrieving and accurate position of where they were hit on. For example it could be used for guns, detecting if a player is under a shelter, finding the distance from the ground, etc.
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 Jan 2015 09:16 PM
Nice, so I was working on reading the wiki, what do these functions do?:

Ray.new()
FindPartOnRay()
Report Abuse
Argelius is not online. Argelius
Joined: 19 Jul 2010
Total Posts: 4047
18 Jan 2015 09:18 PM
Ray.new creates a ray, FindPartOnRay checks for parts intersecting the ray.
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 Jan 2015 09:37 PM
Ah ok! So here's an example script:

function raycast(start,finish,ignore)
local offset=(start-finish).unit
local ray=Ray.new(start,offset)
local hit,pos=game.Workspace:FindPartOnRay(ray,ignore)
if hit and pos then
if hit.Transparency==1 then
hit,pos = raycast(pos,offset,ignore)
end
end
return hit,pos
end

What does this script do?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 Jan 2015 10:44 PM
Anyone?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 Jan 2015 11:10 PM
Please help?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
18 Jan 2015 11:33 PM
Any body?
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
18 Jan 2015 11:55 PM
It's basically the same thing as the raycast function except if it hits a transparent object it will raycast again and again until it actually his a non-transparent object


U wot m8
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
19 Jan 2015 01:32 AM
Oh! Nice. Ok thanks everyone!
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