Rukiryo
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 1490 |
|
|
| 24 Mar 2013 10:07 AM |
Has anyone gotten region3s to work? I created a region3 and I used the method of workspace, FindPartsInRegion3(myregion3,nil,100) It returns 0 parts. Even when I put a bunch in. Can it detect character parts? Thanks |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2013 10:09 AM |
| It detects any parts. Can you post what your 'myregion3' looks like? |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2013 10:10 AM |
| Can you show me your region3 bounds? And yes, it can detect character parts. |
|
|
| Report Abuse |
|
|
Rukiryo
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 1490 |
|
|
| 24 Mar 2013 10:11 AM |
Okay. I'm making a highspeed elevator to replace Pinewoods. It must go fast, so I am going to place the characters into platformstand to reduce the client-server lag. This function attaches them.
function AttachPlayers() print("Attaching players") local r3 = Region3.new(car.R3T.Position,car.R3B.Position) local parts = game.Workspace:FindPartsInRegion3(r3,nil,100) print(#parts.." detected") for i, v in pairs(parts) do print(v.Name) if v.Name == "Torso" and v:IsA("BasePart") and v.Parent ~= nil and v.Parent:findFirstChild("Humanoid") ~= nil and v.Parent.Humanoid.Health > 0 then local w = Instance.new("Weld",v) table.insert(welds,w) w.Part0 = carFloor w.Part1 = v w.C1 = w.Part1.CFrame:toObjectSpace(w.Part0.CFrame) v.Parent.Humanoid.PlatformStand = true end end end
R3T is at the top right corner of the elevator car R3B is at the bottom left of the elevator car
It return 0 parts. |
|
|
| Report Abuse |
|
|
Rukiryo
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 1490 |
|
|
| 24 Mar 2013 10:16 AM |
| You can ignore the bulk of the code. It doesn't even get into the for loop. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2013 10:17 AM |
Try using
local parts = workspace:FindPartsInRegion3WithIgnoreList(r3,{},100)
instead, and see if that helps. |
|
|
| Report Abuse |
|
|
Rukiryo
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 1490 |
|
|
| 24 Mar 2013 10:21 AM |
Gives the error "Unable to cast value to Object" On line 36 (the FindPartInRegion3 part, that you suggested)
I might just give it the elevator car as the ignore list? Idk. That probably won't fix anything. |
|
|
| Report Abuse |
|
|
Rukiryo
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 1490 |
|
|
| 24 Mar 2013 10:27 AM |
| I am completely confused. I ran the exact same code with two test bricks, using the same code, and it works fine. The code that works fine, wouldn't work in my elevator. And yes, I've confirmed that the positions I'm using are correct. Must it be a rounded position? Can it have decimals..? |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2013 10:35 AM |
Region3 limits us to having to use a bunch of methods to make sure our the vectors go from smallest to largest. So in reality, you're going to have to do this (I've spaced it out so it doesn't look like a bulk of code for you):
Region3.new( Vector3.new( math.min(car.R3T.Position.X, car.R3B.Position.X), math.min(car.R3T.Position.Y, car.R3B.Position.Z), math.min(car.R3T.Position.Z, car.R3B.Position.Z) ), Vector3.new( math.max(car.R3T.Position.X, car.R3B.Position.X), math.max(car.R3T.Position.Y, car.R3B.Position.Y), math.max(car.R3T.Position.Z, car.R3B.Position.Z) ) )
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|