datsexyanon

here cool thing, do thing

May 3rd, 2014
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. function buildDonut( count, donutRadius, spiralRadius, spiralCount, basePos )
  2. if not basePos then
  3. basePos = db.actor:position()
  4. basePos.y = basePos.y + 20
  5. end
  6. local trueRad = donutRadius
  7. for x = 1, count do
  8. local angle = ( x / count ) * 2 * math.pi
  9. donutRadius = ( (2*x) / count ) * trueRad
  10. if donutRadius > trueRad then --invert the progression
  11. donutRadius = trueRad - (donutRadius - trueRad)
  12. end
  13. local vectorVec = vector():set( donutRadius * math.cos( angle ), 0, donutRadius * math.sin( angle ) )
  14. local vectorPos = vector():set( vectorVec )
  15. vectorVec:set_length( 1 )
  16. vectorPos.x = vectorPos.x + ( spiralRadius * vectorVec.x * math.cos( angle * spiralCount ) )
  17. vectorPos.y = vectorPos.y + ( spiralRadius * math.sin( angle * spiralCount ) )
  18. vectorPos.z = vectorPos.z + ( spiralRadius * vectorVec.z * math.cos( angle * spiralCount ) )
  19. spawnFixed( "procmod_box"..tostring( math.random( 3 ) ), vector():add( vectorPos, basePos ) )
  20. end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment