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
|
  |
| Joined: 25 Nov 2008 |
| Total Posts: 1272 |
|
| |
|
|
| 07 Jul 2011 09:21 AM |
local part = game.Workspace.WHAT ITS IN.part
--Change what its in to check. |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 25 Nov 2008 |
| Total Posts: 1272 |
|
| |
|
|
| 07 Jul 2011 04:59 PM |
workspace:FindPartsOnRay( Ray ray )
Ray.new( Vector3 Origin, Vector3 Direction ) |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:59 PM |
Hold on, I need to check my brain. IDK Havnt done it in a while. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 07 Jul 2011 05:01 PM |
workspace:FindPartOnRay( Ray ray)
Returns the Part and the point of intersection as a Vector3. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
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 |
|
|
|
| 07 Jul 2011 07:39 PM |
| workspace:FindPartOnRay( Ray ray ) |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 08:23 PM |
| @Favor, read the title and my name >.> |
|
|
| Report Abuse |
|
|
kornawe
|
  |
| Joined: 25 Nov 2008 |
| Total Posts: 1272 |
|
| |
|
|
| 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 |
|
|
|
| 08 Jul 2011 10:27 AM |
| My mistake, that code fire a ray upwards. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|