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 » Scripters
Home Search
 

Re: I need something more efficient than Region3

Previous Thread :: Next Thread 
SuperODgirl9000 is not online. SuperODgirl9000
Joined: 29 Aug 2012
Total Posts: 264
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
SuperODgirl9000 is not online. SuperODgirl9000
Joined: 29 Aug 2012
Total Posts: 264
01 Sep 2012 07:33 PM
Anyone know anything?
Report Abuse
1eggnog is not online. 1eggnog
Joined: 08 Nov 2008
Total Posts: 7074
01 Sep 2012 07:34 PM
Take this to Scripting Helpers.
Report Abuse
SuperODgirl9000 is not online. SuperODgirl9000
Joined: 29 Aug 2012
Total Posts: 264
01 Sep 2012 07:36 PM
Okay...

You guys seemed to know more about scripting than Scripting Helpers. :c
Report Abuse
SuperODgirl9000 is not online. SuperODgirl9000
Joined: 29 Aug 2012
Total Posts: 264
01 Sep 2012 07:42 PM
Scripting Helpers suggested rotating Region3... After I specifically said you cannot rotate Region3 -.-
Report Abuse
Shobobo99 is not online. Shobobo99
Joined: 30 Dec 2008
Total Posts: 5754
01 Sep 2012 07:43 PM
What is this for exactly?
Report Abuse
SuperODgirl9000 is not online. SuperODgirl9000
Joined: 29 Aug 2012
Total Posts: 264
01 Sep 2012 10:06 PM
Anyone know anything??? Scripting Helpers isn't very helpful.
Report Abuse
BrandonFireflower is not online. BrandonFireflower
Joined: 09 Feb 2010
Total Posts: 731
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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