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 » Scripting Helpers
Home Search
 

Re: Ray intersection

Previous Thread :: Next Thread 
kornawe is not online. kornawe
Joined: 25 Nov 2008
Total Posts: 1272
07 Jul 2011 06:39 AM
I need to know if there is an easier less laggy way to see if a part is on a line, not the Position of it, buit all of it any of the side, no matter how odd the shape. Right now I'm working on a hovercraft, but I'm geting all parts and such in workspace, and getting their size and shape, but that lags. Is there an easier way?
Report Abuse
kornawe is not online. kornawe
Joined: 25 Nov 2008
Total Posts: 1272
07 Jul 2011 09:12 AM
Any one?
Report Abuse
FavoringANIMUS is not online. FavoringANIMUS
Joined: 14 Nov 2010
Total Posts: 78
07 Jul 2011 09:21 AM
local part = game.Workspace.WHAT ITS IN.part

--Change what its in to check.
Report Abuse
kornawe is not online. kornawe
Joined: 25 Nov 2008
Total Posts: 1272
07 Jul 2011 09:45 AM
Not helpful, I don't even know where you got that from I can make a brick, and find a brick. I need to know if there is an easy way to find if a Ray hits a part.
Report Abuse
kornawe is not online. kornawe
Joined: 25 Nov 2008
Total Posts: 1272
07 Jul 2011 04:46 PM
...
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 04:59 PM
workspace:FindPartsOnRay( Ray ray )

Ray.new( Vector3 Origin, Vector3 Direction )
Report Abuse
FavoringANIMUS is not online. FavoringANIMUS
Joined: 14 Nov 2010
Total Posts: 78
07 Jul 2011 04:59 PM
Hold on, I need to check my brain.
IDK
Havnt done it in a while.
Report Abuse
FavoringANIMUS is not online. FavoringANIMUS
Joined: 14 Nov 2010
Total Posts: 78
07 Jul 2011 05:00 PM
2 above, NO. He dont mean that, he means if the ray hits a Certain brick then it removes or something, or just checking.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 05:01 PM
workspace:FindPartOnRay( Ray ray)


Returns the Part and the point of intersection as a Vector3.
Report Abuse
Rayblox150 is not online. Rayblox150
Joined: 29 Dec 2010
Total Posts: 2790
07 Jul 2011 05:10 PM
Lol title O.O
Report Abuse
FavoringANIMUS is not online. FavoringANIMUS
Joined: 14 Nov 2010
Total Posts: 78
07 Jul 2011 06:49 PM
How?
Report Abuse
kornawe is not online. kornawe
Joined: 25 Nov 2008
Total Posts: 1272
07 Jul 2011 07:36 PM
I can make a ray, I need to know when that ray hit's a brick
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 07:39 PM
workspace:FindPartOnRay( Ray ray )
Report Abuse
Rayblox150 is not online. Rayblox150
Joined: 29 Dec 2010
Total Posts: 2790
07 Jul 2011 08:23 PM
@Favor, read the title and my name >.>
Report Abuse
kornawe is not online. kornawe
Joined: 25 Nov 2008
Total Posts: 1272
08 Jul 2011 10:24 AM
Finaly usefulness.
Report Abuse
XhappysmileX is not online. XhappysmileX
Joined: 22 Feb 2009
Total Posts: 124
08 Jul 2011 10:26 AM
Below is an example of shooting a ray down 500 studs.

local Distance = 500
local ray = Ray.new(Part1.Position, Vector3.new(0,1,0) * Distance)
local hitpart, hitpoint = Workspace:FindPartOnRay(ray)
Report Abuse
XhappysmileX is not online. XhappysmileX
Joined: 22 Feb 2009
Total Posts: 124
08 Jul 2011 10:27 AM
My mistake, that code fire a ray upwards.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
08 Jul 2011 10:28 AM
Technically, that would be shooting up.
HOWEVER, I've a question about that.

It seems that the distance of the ray is 1000 no matter what (or whatever the max distance is). Since the second Vector3 value is assumed to be a unit vector, the distance is ignored, right?

The Wiki fails to explain this.
Report Abuse
XhappysmileX is not online. XhappysmileX
Joined: 22 Feb 2009
Total Posts: 124
08 Jul 2011 10:32 AM
No, the distance is not ignored.

The distance is not expected to be a unit vector. It is just supposed to be how far away from the starting point the ray should go.

Vector3.new(0,1000,0) -- 1,000 studs up.
Report Abuse
Bubby4j is not online. Bubby4j
Joined: 25 Dec 2008
Total Posts: 1831
08 Jul 2011 10:40 AM
It won't know what direction to raycast unless you use a unit vector.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
08 Jul 2011 12:50 PM
@Bubby

Uh.....that is the dumbest thing I have ever heard. When you multiply the unit by the distance (which you do before calling the function) it is no longer a unit vector.
Report Abuse
kornawe is not online. kornawe
Joined: 25 Nov 2008
Total Posts: 1272
08 Jul 2011 06:43 PM
tHE MAX IS 1K STUDS, you can make it less.
Report Abuse
Bubby4j is not online. Bubby4j
Joined: 25 Dec 2008
Total Posts: 1831
08 Jul 2011 09:28 PM
You know, I think someone told me some wrong info. I read the wiki, now I understand how it works.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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