|
| 08 Sep 2013 01:24 PM |
How would I do that? castRay(script.Parent.Torso.Position,nil) The starting position is the Torso, and I don't know to make it infinite in the direction the Torso is facing.
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Sep 2013 01:27 PM |
| Will you be making a brick go in the direction of the ray? Like a Laser? |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:28 PM |
Yeah pretty much... I'm just seeing if I can make an AI, and for a good one you may need to use a ray.
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 08 Sep 2013 01:29 PM |
I also wonder about this. This is what he wants.
A ray starts from the torso. The ray will remain at the same lookVector as the torso. The ray never ends. |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Sep 2013 01:29 PM |
| Bricks have a size limit. It can't be infinite. |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 08 Sep 2013 01:30 PM |
| Well, yeah. Let's just say '2000.' |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:31 PM |
Yes, but how do I put that in terms for my script? If I leave the second argument nil then I get an error.
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
| |
|
|
| 08 Sep 2013 01:32 PM |
I'm not making a brick for it, I'm just using a ray, and as far as I know a ray is finite in one direction and infinite in the other. So therefore, it can be infinite.
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:34 PM |
Do you want the ray to stop if it hits something, or just continue through all other parts?
If it goes through all parts, then:
local origin, direction = Torso.Position, Torso.CFrame.lookVector; part.CFrame = CFrame.new(origin + direction.unit * part.Size.z / 2, origin);
Make it elongated along the z axis. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:36 PM |
What I wanted was it to be infinite in one direction and detects if it hits something. So it can go as far as it wants to and still looks for an object to hit.
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:39 PM |
Basically, I want the ray to be infinite in ONLY the direction the torso is facing, I tried the lookVector of the torso, but that just seemed to find the BasePlate no matter where I positioned a block.
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Sep 2013 01:40 PM |
| local hit = Workspace:FindPartOnRay(ray) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:41 PM |
Never mind, I fixed it. I just needed to make the second argument 0,0,0. Go figure...
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:42 PM |
function castRay(start,End) local ray = Ray.new(start, (End - start).unit*-500) local hit,pos = game.Workspace:FindPartOnRay(ray,script.Parent) if hit then print(hit.Name) end end
while wait() do castRay(script.Parent.Torso.Position,Vector3.new(0,0,0)) end
That's what I was using. I just posted the call of the function because that was my only problem basically.
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|
chris1989
|
  |
| Joined: 30 Nov 2007 |
| Total Posts: 2520 |
|
|
| 08 Sep 2013 01:47 PM |
LookVector is probably set up wrong havent used it in awhile.
local ray = Ray.new(ai.Torso.Position, ai.Torso.LookVector * 2000) local part, endpoint = workspace:FindPartOnRay(ray) if Part then --stuff end |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:54 PM |
Chris, thanks works even better now, :P.
"U BROKE THE TV U IDIOT!" - CeaselessSoul |
|
|
| Report Abuse |
|
|