JoPmt commited on
Commit
d9ffc46
1 Parent(s): db4a700

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -51,16 +51,18 @@ def create_planet_flyby_animation(planet, radius, duration):
51
  planet.location = (x, y, z)
52
  planet.keyframe_insert(data_path="location", index=-1, frame=frame)
53
 
54
- def add_animated_space_rocks():
55
  bpy.context.scene.render.fps = 10
56
  duration = 2
57
  radius=2
58
- for i in range(30):
59
- bpy.ops.mesh.primitive_uv_sphere_add(radius=random.uniform(0.03, 0.1), location=(random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-4, 9)))
60
- i = bpy.context.active_object
61
- i.keyframe_insert(data_path="location", frame=1)
62
- i.location = (random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-10, 10))
63
- i.keyframe_insert(data_path="location", index=-1, frame=20)
 
 
64
 
65
 
66
  def create_particle_effects_animation():
@@ -157,9 +159,9 @@ def create_scene():
157
  ##planet2 = add_planet("mars", 1.75, 0.5, 1.5)
158
  add_planet("earth", 2.5, 1, 0)
159
  add_planet("mars", 1.75, 0.5, 1.5)
160
-
161
- add_animated_space_rocks()
162
- create_meteor_with_particle_system()
163
  ##create_particle_effects_animation()
164
  ##create_planet_flyby_animation(planet1, 4, 2)
165
  ##visualize_planets()
 
51
  planet.location = (x, y, z)
52
  planet.keyframe_insert(data_path="location", index=-1, frame=frame)
53
 
54
+ def add_animated_space_rocks(name):
55
  bpy.context.scene.render.fps = 10
56
  duration = 2
57
  radius=2
58
+ space_rock.name = ""+name+"_"+random.randint(1,100)+""
59
+ bpy.ops.mesh.primitive_uv_sphere_add(radius=random.uniform(0.03, 0.1), location=(random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-4, 9)))
60
+ space_rock = bpy.context.active_object
61
+ space_rock.keyframe_insert(data_path="location", frame=1)
62
+ space_rock.location = (random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-10, 10))
63
+ space_rock.keyframe_insert(data_path="location", frame=20)
64
+ bpy.context.view_layer.objects.active = space_rock
65
+ space_rock.select_set(True)
66
 
67
 
68
  def create_particle_effects_animation():
 
159
  ##planet2 = add_planet("mars", 1.75, 0.5, 1.5)
160
  add_planet("earth", 2.5, 1, 0)
161
  add_planet("mars", 1.75, 0.5, 1.5)
162
+ for i in range(30):
163
+ add_animated_space_rocks("spacerock")
164
+ ##create_meteor_with_particle_system()
165
  ##create_particle_effects_animation()
166
  ##create_planet_flyby_animation(planet1, 4, 2)
167
  ##visualize_planets()