Skip to content

Instantly share code, notes, and snippets.

@eliheuer
Created May 29, 2017 16:19
Show Gist options
  • Save eliheuer/109e02303dc7a89c91aca3ddd1ed6e67 to your computer and use it in GitHub Desktop.
Save eliheuer/109e02303dc7a89c91aca3ddd1ed6e67 to your computer and use it in GitHub Desktop.
Blender Metaball Test 002
import bpy
import math
scene = bpy.context.scene
# add metaball object
mball = bpy.data.metaballs.new("MetaBall")
obj = bpy.data.objects.new("MetaBallObject", mball)
step = 0
pull = 0
scene.objects.link(obj)
mball.resolution = 0.2
mball.render_resolution = 0.02
for i in range(512):
coordinate = ((math.sin(step/2) + (math.cos(step) * step/2)),
(math.cos(step/2) + (math.sin(step) * step/2)),
pull*0.5)
step += 0.2
pull += 0.4
element = mball.elements.new()
element.co = coordinate
element.radius = 2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment