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: In-game terrain tools

Previous Thread :: Next Thread 
XBLAX is not online. XBLAX
Joined: 06 Apr 2012
Total Posts: 82
19 Oct 2016 02:16 PM
Greetings.
I have been working on some terrain tools lately and it seems to be coming on well, yet there was an issue that occurred when wanting to incorporate an inventory with said tools.

The inventory, in this case, would be used to store certain values of a terrain material so it may be used in a future point in time. But the only way I've found to read the terrain material is by using Region3. The issue I'm having is that the region does not always pick up the physical terrain, instead just 'air'. I was wondering if anybody could help me with this?
Report Abuse
XBLAX is not online. XBLAX
Joined: 06 Apr 2012
Total Posts: 82
19 Oct 2016 02:43 PM
Bump?
Report Abuse
XBLAX is not online. XBLAX
Joined: 06 Apr 2012
Total Posts: 82
19 Oct 2016 03:13 PM
Maybe I should just present what I have so far.

local tool = script.Parent.Parent
local plr = game:GetService("Players").LocalPlayer
local lastmat
tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
local region = Region3.new(mouse.Hit.p, Vector3.new(mouse.Hit.X-1,mouse.Hit.Y-1,mouse.Hit.Z-1))
region = region:ExpandToGrid(4)
local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, 4)
local size = material.Size
for x = 1, size.X do
for y = 1, size.Y do
for z = 1, size.Z do
if material[x][y][z] ~= Enum.Material.Air and material[x][y][z] ~= Enum.Material.Water then -- attempt to ignore water...
print("Material at (", x, y, z, "): ", material[x][y][z])
wait(0.5)
game.Workspace.Terrain:FillBall(mouse.Hit.p, 4, Enum.Material.Air)

end
end
end
end
end)
end)
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