generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Region3 Help?

Previous Thread :: Next Thread 
Rukiryo is not online. 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
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
24 Mar 2013 10:09 AM
It detects any parts. Can you post what your 'myregion3' looks like?
Report Abuse
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
24 Mar 2013 10:10 AM
Can you show me your region3 bounds? And yes, it can detect character parts.
Report Abuse
Rukiryo is not online. 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 is not online. 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
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
24 Mar 2013 10:17 AM
Try using

local parts = workspace:FindPartsInRegion3WithIgnoreList(r3,{},100)

instead, and see if that helps.
Report Abuse
Rukiryo is not online. 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 is not online. 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
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image