How do I create a Raycast between two parts?
Asked by
5 years ago Edited 5 years ago
I have a script below that I am using as a reference. I am wondering how I can make a Ray between two parts I have in Workspace. The parts are named "Part" and "Part1".
Reference -
1 | local Ray = Ray.new(game.Workspace.vislbIe.HumanoidRootPart.Position, game.Workspace.vislbIe.HumanoidRootPart.Position - Vector 3. new( 0 , 3 , 0 )) |
3 | local part = game.Workspace:FindPartOnRay(Ray,game.Workspace.vislbIe) |
Now, I want to make a Ray begin on Part, then end at Part1. Here is a script from Roblox Wiki, this script is how I want to make my ray, minus the Tool handle.
2 | Weapon.Handle.CFrame.p, |
3 | (mouse.Hit.p - Weapon.Handle.CFrame.p).unit * 500 |
5 | local ignore = game.Players.LocalPlayer.Character |
6 | local hit, position, normal = Workspace:FindPartOnRay(ray, ignore) |
Any solutions?
http://prntscr.com/ntni5s
Screenshot of parts above.