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: Why are there no good Ray Casting tutorials...

Previous Thread :: Next Thread 
ReverseUniverse is not online. ReverseUniverse
Joined: 23 Jan 2015
Total Posts: 1118
11 May 2015 02:04 PM
The only stuff i can find is people making guns.

Could any of you guys give me an example of creating a ray by, starting it from a parts position and sending it to another parts position, or just send the ray out of the part?
Report Abuse
ReverseUniverse is not online. ReverseUniverse
Joined: 23 Jan 2015
Total Posts: 1118
11 May 2015 02:06 PM
1
Report Abuse
vectorGunner is not online. vectorGunner
Joined: 23 Mar 2014
Total Posts: 784
11 May 2015 02:07 PM
I'm pretty sure it's as simple as can be.

origin = Vector3.new() or Part.CFrame.p
direction = Vector3.new().unit or Part.CFrame.lookVector
ray = Ray.new(origin, direction)
--Ray manipulation
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
11 May 2015 02:07 PM
Direction is end-start. That should solve that riddle
Report Abuse
ReverseUniverse is not online. ReverseUniverse
Joined: 23 Jan 2015
Total Posts: 1118
11 May 2015 02:13 PM
How to check if something hits the ray?
Report Abuse
ReverseUniverse is not online. ReverseUniverse
Joined: 23 Jan 2015
Total Posts: 1118
11 May 2015 02:14 PM
Do you use :FindPartOnRay ?
Report Abuse
ReverseUniverse is not online. ReverseUniverse
Joined: 23 Jan 2015
Total Posts: 1118
11 May 2015 02:15 PM
So lets say you sent the ray from one part to the other and something happened to get between the ray?

How would you print the name of what hit the ray?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
11 May 2015 02:16 PM
Workspace:FindPartOnRay(Ray RayToFind, Instance Ignore) -> Instance ?Part, Vector3 ?Location, NormalId ?Surface

Last I heard
Report Abuse
vectorGunner is not online. vectorGunner
Joined: 23 Mar 2014
Total Posts: 784
11 May 2015 02:19 PM
Yes.

game.Workspace:FindRayOnPart(ray) will return the part hit and position it hit the part as a vector3.
so...
obj, position = game.Workspace:FindPartOnRay(ray)
then you can make it ignore with FindPartOnRay but only 1 'model' and it's descendants.
obj, position = game.Workspace:FindPartOnRay(ray, game.Workspace.Player1)
to ignore multiple 'models' just use FindPartOnRayWithIgnoreList
obj, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, { game.Workspace.Player1, game.Workspace.Player2 }

hope this helped at all.
Report Abuse
ReverseUniverse is not online. ReverseUniverse
Joined: 23 Jan 2015
Total Posts: 1118
11 May 2015 02:23 PM
Wish there was a good video explaining ray casting but Thank you all for your help.
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