|
| 11 May 2013 04:47 PM |
| I've read through the Raycasting Wiki and I'm just a little stuck on how to make it so the bullet shoots from the barrel to where the mouse cursor is. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 11 May 2013 04:50 PM |
| You set the direction in the raycast script.Make a loop for that direction. |
|
|
| Report Abuse |
|
|
|
| 11 May 2013 04:58 PM |
I am COMPLETELY new to Raycasting and all I got so far is:
local ray = Ray.new()
xD |
|
|
| Report Abuse |
|
|
|
| 11 May 2013 05:29 PM |
Ok, this is what I have got so far:
local tool = script.Parent local player tool.Equipped:connect(function(mouse) player = tool.Parent mouse.Button1Down:connect(function() local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300) local hit, position = game.Workspace:FindPartOnRay(ray, player) if hit then if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid:TakeDamage(math.random(0, 10)) --Make it fire from the handle to where the mouse cursor is end end end) end)
How would I make it travel from the handle to the mouse cursor? |
|
|
| Report Abuse |
|
|