Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. for i=2, count do
  2.                 newObj = nil
  3.                 if positions ~= nil then
  4.                     newObj = object.clone({position = positions[i]})
  5.                 else
  6.                     object.clone({position = {x = math.random(0, xMax) * step + start.x, y = start.y, z = math.random(0, zMax) * step + start.z}})
  7.                 end
  8.                 local bounds = object.getBounds()
  9.                 local pos = object.getPosition()
  10.                 local hitList = Physics.cast({
  11.                     origin          = {pos.x, pos.y, pos.z},
  12.                     direction       = {0,-1,0},
  13.                     type                = 3,
  14.                     size                = {bounds.size.x, bounds.size.y, bounds.size.z},
  15.                     max_distance    = 5,
  16.                     debug               = true
  17.                 })
  18.                 for _, entry in ipairs(hitList) do
  19.                     local offsetX = 0.905
  20.                     local name = entry.hit_object.getName()
  21.                     print(name)
  22.                     if name ~= object.getName() and name ~= "Table" then
  23.                         local bounds = entry.hit_object.getBounds()
  24.                         local new_pos = {bounds.center.x - offsetX * 6, 1.5, pos.z}
  25.                         object.setPosition(new_pos)
  26.                     end
  27.                 end
  28.                 Wait.condition(function() terrainBag.putObject(object) end, function() return checkLoaded(object) end)
  29.             end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement