2
$\begingroup$

I wrote a script to divide a 'Plane' into N Pieces and then Parented each Piece to a specific Lipid (3D model with van der waal surface). Then I use face duplication to populate each face with it's Child. The Final Plane will then look like below:

enter image description here

I did many tricks to make this patch a random so that they do not look like lined up in a linear fashion.

Now, I find some small spaces which I do not want between them.

Is there any way to add these Lipids tightly (as close as much they can - but with collision - each objects must not ram in each other) placed/packed in a defined area using Python?

Actually, I want to animate them like Molecular dynamics - So, a little wobbling motion will work for me.

How can I add objects in a defined area which are tightly packed in it?

$\endgroup$
  • $\begingroup$ Can you share a blend file? Since the geometry is complex, it's hard to test how a solution looks with simple shapes. $\endgroup$ – Ed Tate May 10 '17 at 15:18
  • $\begingroup$ You can see the Geometry of mesh object in the following link. drive.google.com/open?id=0B5w9cJ7DdaqDOTE5TjFHTng4TWc But how does it also works for simple objects like cylender or cubes. I just want to have some directions. $\endgroup$ – mGm May 11 '17 at 17:03
1
$\begingroup$

An animation of the lipid molecules can be generated using the rigid body collisions.

enter image description here


The steps to reproduce this animation are:

  1. Use the particle system to place the molecules initially.

    • Add a flat surface to place the molecules on.

      enter image description here

    • Use the particle system to place the molecules on the surface in a regular grid. Using a regular grid will prevent the molecules from intersecting each other.

      enter image description here enter image description here

    • Setup the display to use the lipid geometry for rendering.

      enter image description here enter image description here

  2. Convert the particle system into individual objects.

    • Press the convert button for the particle system modifier. enter image description here
  3. Convert the lipid molecules into rigid bodies.

    • Select the first lipid molecule in the scene.
    • Add the rigid body physics to the object.

    enter image description here

    • Select all lipid objects.
    • Deselect, then select the first lipid molecule again.
    • In the left hand panel of the 3D viewer, select the Physics tab, and click on 'Copy from Active'. This will copy the physics setting to all of the lipid molecules.

    enter image description here

  4. Add a mesh to act as a container for all of the lipid molecules.

    • Add geometry. The geometry should be larger than the initial placement of the lipids. The height of the container should be slightly larger than the height of the lipids. The top and bottom of the container will help keep the lipids from moving up or down.

    enter image description here

    • Set the container as an animated rigid body. So the interior of the container keeps the lipids in place, the 'Shape' needs to be set to 'Mesh'.

    enter image description here

  5. Change the direction of gravity to point towards one of the container walls. This cause all of the lipids to pack in a horizontal direction.

    enter image description here

  6. Animate the container with noise. This will make the molecules randomly move about.

    • Insert a keyframe at the start of the timeline.

    enter image description here

    • Modify the animation graphs with noise. This will cause the walls of the container to move around and bounce into the lipids. This will cause the lipids to bounce around during the animation.

    enter image description here

  7. Animate the result!


The finished blend file is located at blend-exchange file

$\endgroup$
  • $\begingroup$ +Ed Tate, This is a nice tutorial and an acceptable answer for me. Recently, I tried some python scripting to play around particle systems. But it seems that the script does not fully control the behavior of particle system. Like what we do in the panel and copying the commands from the info screen wont work efficiently. $\endgroup$ – mGm May 23 '17 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.