Skip to content

Commit

Permalink
Add particle system with Follow leader rule
Browse files Browse the repository at this point in the history
  • Loading branch information
sfmig committed Jul 16, 2024
1 parent 57f0524 commit d92e71b
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions biig_ants/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

# TODO
# - make fns
# - scale not working?


import argparse
import math
import sys

import addon_utils
Expand Down Expand Up @@ -105,6 +107,52 @@ def main():
auto_refresh=True,
)

###########################
# Add emitter plane
###########################
bpy.ops.mesh.primitive_plane_add(
size=2,
enter_editmode=False,
align='WORLD',
scale=(0.5, 0.5, 0.5), #---why ignored?
location=(-1, 0, 1), # m
rotation=(0, math.pi/2, 0), # rad
)


###########################
# Add particle system
###########################
bpy.ops.object.particle_system_add()
bpy.data.particles["ParticleSettings"].physics_type = 'BOIDS'

# make this CLI / config params?
bpy.data.particles["ParticleSettings"].count = 10
bpy.data.particles["ParticleSettings"].lifetime = 200
bpy.context.object.particle_systems["ParticleSystem"].seed = 42


bpy.data.particles["ParticleSettings"].boids.use_land = True
bpy.data.particles["ParticleSettings"].boids.use_flight = False

# delete existing rules of boid brain
settings = bpy.data.particles["ParticleSettings"]
with bpy.context.temp_override(particle_settings=settings):
bpy.ops.boid.rule_del() # probs there is a better way to do this
bpy.ops.boid.rule_del()
bpy.ops.boid.rule_add(type='FOLLOW_LEADER')

# Make a sphere lord


# Make boids be insects


# Set up camera


# Define render settings


if __name__ == "__main__":
# get all arguments after '--' (all after -- are not read by blender)
Expand Down

0 comments on commit d92e71b

Please sign in to comment.