62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 23 Nov 2015 12:45 PM |
local part, position = workspace:FindPartOnRayWithIgnoreList(ray,game.Players.LocalPlayer.Character,{cueball})
something's wrong with this, i hate raycasting. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|
|
| 23 Nov 2015 12:54 PM |
It doesn't take a table for the third argument. It takes a boolean. The second argument takes a table, and you aren't giving it a table for the second argument.
Technically, it takes a table for the third argument, but you are giving your table in the fourth, but disregard this if you are confused now. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 23 Nov 2015 12:58 PM |
-Lightbulb appears-
Oh! Let me make some edits.. Thanks! |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 23 Nov 2015 01:02 PM |
Full section:
Now the part where it checks to see if there are any obstructing balls in the ray's path isn't working. What it's supposed to do if there are any obstructing balls in the path is to recalculate the ray before the actual beam is made.
local ray = Ray.new(cue.Point.CFrame.p,cue.Point.CFrame.lookVector.unit * 300) local part, position = workspace:FindPartOnRayWithIgnoreList(ray,{game.Players.LocalPlayer,cueball}) if part then pcall(function() if string.match(part.Name,"Ball") then print(math.random(1,50000)) ray = Ray.new(cue.Point.CFrame.lookVector,part.Position).unit * 300 end end) end local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("Black") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = .3 beam.Anchored = true beam.Locked = true beam.CanCollide = false local distance = (cue.Point.CFrame.lookVector - position).magnitude beam.Size = Vector3.new(.1,.1,distance) beam.CFrame = CFrame.new(cue.Point.CFrame.p,position) * CFrame.new(0,0,-distance / 2) current_ray = beam |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 23 Nov 2015 01:04 PM |
| Okay I got it to actually print something, but it won't recalculate the ray. :( |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 23 Nov 2015 01:08 PM |
| Doesn't seem to be changing the 'ray' variable, cause I put a print after the code did that but it never printed, it just printed the random numbers. |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2015 01:13 PM |
"game.Players.LocalPlayer" No descendants of LocalPlayer will be Parts anyways, so you can just remove that, unless you mean Character, in which case you should change it. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 23 Nov 2015 01:14 PM |
| Oh lol. But back to the problem pls? |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 23 Nov 2015 01:19 PM |
Ah it was one of those probs where you had to put in a wait() and first make the Ray variable nil.. :P
But now it's a math problem:
ray = Ray.new(cue.Point.CFrame.lookVector,part.Position)
I need to generate a ray from the Point's looking direction to the part's position, not going through it. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 23 Nov 2015 01:24 PM |
| Think I'm gonna ask for a bump. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|