Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function buildDonut( count, donutRadius, spiralRadius, spiralCount, basePos )
- if not basePos then
- basePos = db.actor:position()
- basePos.y = basePos.y + 20
- end
- local trueRad = donutRadius
- for x = 1, count do
- local angle = ( x / count ) * 2 * math.pi
- donutRadius = ( (2*x) / count ) * trueRad
- if donutRadius > trueRad then --invert the progression
- donutRadius = trueRad - (donutRadius - trueRad)
- end
- local vectorVec = vector():set( donutRadius * math.cos( angle ), 0, donutRadius * math.sin( angle ) )
- local vectorPos = vector():set( vectorVec )
- vectorVec:set_length( 1 )
- vectorPos.x = vectorPos.x + ( spiralRadius * vectorVec.x * math.cos( angle * spiralCount ) )
- vectorPos.y = vectorPos.y + ( spiralRadius * math.sin( angle * spiralCount ) )
- vectorPos.z = vectorPos.z + ( spiralRadius * vectorVec.z * math.cos( angle * spiralCount ) )
- spawnFixed( "procmod_box"..tostring( math.random( 3 ) ), vector():add( vectorPos, basePos ) )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment