|
| 01 Sep 2012 07:30 PM |
local x1 = 5 local y1 = 5 local z1 = 50 local start_point = (game.Workspace.Player325.Head.CFrame*CFrame.new(-x1,-y1,0)).p local end_point = (game.Workspace.Player325.Head.CFrame*CFrame.new(x1,y1,-z1)).p
r3 = Region3.new( Vector3.new( math.min(start_point.X, end_point.X), math.min(start_point.Y, end_point.Y), math.min(start_point.Z, end_point.Z) ), Vector3.new( math.max(start_point.X, end_point.X), math.max(start_point.Y, end_point.Y), math.max(start_point.Z, end_point.Z) ) )
p = Instance.new("Part") p.Size = Vector3.new(x1*2,y1*2,z1) p.CFrame = game.Workspace.Player325.Head.CFrame*CFrame.new(0,0,-z1/2) p.Name = "SimulatedRegion3" p.TopSurface = "Smooth" p.BottomSurface = "Smooth" p.CanCollide = false p.Anchored = true p.Transparency = 0.5 p.Parent = game.Workspace.Player325 game.Debris:AddItem(p,3)
table = game.Workspace:FindPartsInRegion3(r3, game.Workspace.Player325, 20)
print("Found "..#table.." Parts") print("------------------------")
for i=1,#table do print(table[i].Name) wait(0.1) end
print("------------------------")
This script checks for parts in a 6x6x50 region in front of my character's face. However, I can't use this because Region3 cannot be rotated...
Anything better I could use that CAN be rotated?
|
|
|
| Report Abuse |
|
|
| |
|
1eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 7074 |
|
|
| 01 Sep 2012 07:34 PM |
| Take this to Scripting Helpers. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 07:36 PM |
Okay...
You guys seemed to know more about scripting than Scripting Helpers. :c |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 07:42 PM |
| Scripting Helpers suggested rotating Region3... After I specifically said you cannot rotate Region3 -.- |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
| |
|
|
| 01 Sep 2012 10:06 PM |
| Anyone know anything??? Scripting Helpers isn't very helpful. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 10:29 PM |
I would assume vision.
If you *really* need to, use raycasting and a Reigon3. Use the Reigon3 for a first check, then see if it's in the scope of the vision by using raycasting. Using both will cut down on lag, because it'll be an easy out.
--BrandonFireflower, LuaLearners Writer and president of the Exodus Task Force. |
|
|
| Report Abuse |
|
|