|
| 17 Nov 2014 06:50 PM |
local ray = Ray.new(lastVector.Position,lastVector.CFrame.lookVector*5) local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, {Workspace.Ignore}) local distance = (position - lastVector.Position).magnitude local rayPart = Instance.new("Part",Workspace.Ignore) rayPart.Name = "RayPart" rayPart.BrickColor = BrickColor.Blue() rayPart.Anchored = true rayPart.CanCollide = false rayPart.TopSurface = Enum.SurfaceType.Smooth rayPart.BottomSurface = Enum.SurfaceType.Smooth rayPart.FormFactor = Enum.FormFactor.Custom rayPart.Size = Vector3.new(0.2, 0.2, distance) rayPart.CFrame = CFrame.new(position, lastVector.CFrame.p) * CFrame.new(0, 0, -distance/2) rayPart.Transparency = 0.75 game:GetService("Debris"):AddItem(rayPart,0.025) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Nov 2014 06:52 PM |
| The "lookVector" is the relative -z axis of a CFrame (which returns a unit vector). |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Nov 2014 07:03 PM |
| Well is your problem that it's not shooting forward? It seems to be fine. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 07:09 PM |
| Its not shooting forward based on the rotation of the starting point, its shooting torwards the Z Axis no matter what |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 07:18 PM |
| Fixed it, had to rotate the vectors for the lookVector to work properly. |
|
|
| Report Abuse |
|
|