|
| 10 May 2012 09:47 PM |
this is supposed to raycast to a point and check if anything is blocking a direct path to it. However even when there is a clear path it returns false. With all the extra debugging and prints i thrown in there i've come to notice that its casting rays much higher above the point(node) and the torso, so there must be something wrong with the raycasting. Halp?
function checkPath(node) wait() local ray = Ray.new(torso.Position,node.Position) local hit,pos = Workspace:FindPartOnRay(ray,script.Parent) if hit and hit ~= node then mag = (pos - torso.Position).magnitude print(node.Name..": invalid - ",hit,">",hit.Parent," | "..mag) hit.BrickColor = BrickColor.new("Really blue") -- color hit part blue for testing. return false elseif hit == node or hit == destination then print(node.Name..": Valid - ",hit) return true end end |
|
|
| Report Abuse |
|
|
|
| 11 May 2012 01:29 AM |
local Ray = Ray.new(torso.CFrame.p, (node.CFrame.p - torso.CFrame.p).unit*300) local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance. |
|
|
| Report Abuse |
|
|
|
| 11 May 2012 02:03 PM |
| o____o thank you so much! That fixed it! It works perfectly :D :D :D i give you +9001 internets, 1337 cookies and an ever so manly brofist. |
|
|
| Report Abuse |
|
|