Hoit Posted December 21, 2015 Share Posted December 21, 2015 Hey guys I'm trying to write a piece of code that will build a wall around a turf tile once it's placed. But the problem is, that it depends on where the mouse was clicked (so the wall can have different positions even if the tile is the same, but mouse was clicked in different corners of it). I get coordinates from the pt variable, how can I get the coordinates of the turf block under that point?This is the code that builds the wall:local function ondeployturf(inst, pt, deployer) -- ... local x = math.floor(pt.x) - 3.5 local z = math.floor(pt.z) - 3.5 for i=1,7,1 do for j=1,7,1 do if i == 1 or i == 7 or j == 1 or j == 7 then local wall = GLOBAL.SpawnPrefab("wall_wood") wall.Physics:Teleport(x + i, 0, z + j) end end endendThanks a lot! Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now