opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 02:07 PM |
How would I change which way the ray is pointing. I'm new the raycasting and I find is fairly hard to learn due to the lack of it's documentation. local p, collision = Workspace:FindPartOnRay(Ray.new(Vector3.new(0,0,0),Vector3.new(100,100,100),nil) |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
| |
|
Solotaire
|
  |
| Joined: 30 Jul 2009 |
| Total Posts: 30356 |
|
|
| 17 Sep 2012 02:15 PM |
| I believe the second argument is the end direction in Ray.new. Change that. |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 02:17 PM |
@script Thanks, you didn't have the need to insult me. It isn't documented well 6 lines of code is not nearly enough. |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 02:30 PM |
| You can't seem to help anyone with out trying to insult them. |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 02:34 PM |
| Could you quote where I was being ignorant? |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 02:39 PM |
It's true, I can't find anything good and I still can't.
I have no idea, what the "x 180" part means on the end. Is 180 the angle? I have no idea how to return it's position. I'm trying it now and apparently it's position is nil, yet it can name the part. It only seem's to be able to find the part once I move the part.
All i'm attempting to do is return the distance between 2 parts. |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 02:42 PM |
I have no idea, there's no documentation of how to control that either. (That I can find) At the moment i'm trying to pull extracts out of similar scripts and learn from them. Which isn't working. |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 02:50 PM |
pos = script.Parent.Position local p, collision = Workspace:FindPartOnRay(Ray.new(Vector3.new(pos),Vector3.new(0,-100,0) * 500),nil) print(p)
So the ray start point will be the position of the brick and the ray end point will be 100 studs downwards from the brick position and 500 studs wide right? How come it's returning nil when there is clearly a part less than 100 studs under it? |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2012 02:51 PM |
The first argument is the start point, whilst the second argument is the direction. so if my start point was Vector3.new(0,0,0), and my dir-point was Vector3.new(0,10,0), then my ray will point upwards.
-> Siggy pooped by the power of Ponies <- |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 02:58 PM |
This is in a moving part by the way. As it moves along I need it to return the part that is underneath it.
So far this is what I have, although I dont think the brick.Y - 10 isn't going to work.
while true do wait(2) brick = script.Parent.Position local p, collision = Workspace:FindPartOnRay(Ray.new(Vector3.new(brick),Vector3.new(brick.Y - 10) * 5),nil) print(p) end |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2012 03:00 PM |
Replace:
Vector3.new(brick.Y-10)
With:
Vector3.new(brick.X,brick.Y-10,brick.Z)
-> Siggy pooped by the power of Ponies <- |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 03:08 PM |
| Ugh, I'm fed up with it. That works but it doesn't return all the bricks. So like if there was a brick called part 2 and that was ontop of a brick called part 1 it would only return part 1 even though that was under part2.. |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
| |
|
129K
|
  |
| Joined: 23 Aug 2011 |
| Total Posts: 19010 |
|
|
| 17 Sep 2012 03:25 PM |
"you because your being ignorant."
you're* |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 17 Sep 2012 03:28 PM |
Okay forget all of that. This way is working. How would I make the f ray look downwards at an angle, so like infront of it but down towards the floor. Would I use the cord's like (0, -80, 80)?
while true do wait(2) Bottom = script.Parent local p, collision = Workspace:FindPartOnRay(Ray.new(Bottom.Position, Bottom.Position + Vector3.new(0,-700,0)),nil) local f, collision = Workspace:FindPartOnRay(Ray.new(Bottom.Position, Bottom.Position + Vector3.new(0,0,80)),nil) print(p) print(f) end |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
| |
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
| |
|