What is new in Mekanimo 1.2

Mekanimo 1.2 Beta is the release candidate for Mekanimo’s first commercial release. To download it please go to http://www.mekanimo.net.

New Additions

Sprite Browser

The sprite browser (see Figure 1) allows you to view sprites before assigning them to a rigid body. The multi-picture sprites are displayed as animations. The user can toggle the “No sprite” checkbox located on the upper right corner to inactivate assigned sprite.


Figure 1: Sprite Browser

Texture Browser

The texture browser (see Figure 2) allows you to view textures before assigning them to a rigid body. Texture blocks are displayed in their stitched state. The user can toggle the “No texture” checkbox located on the upper right corner to inactivate assigned texture.


Figure 2: Texture Browser

Sound Sampler

The sound sampler (see Figure 3) allows you to listen to the sounds before assigning them. The user can assign sounds to conditions defined via the behavior dialog box.


Figure 3: Sound Sampler

Library Menu

The library menu (see Figure 4) is located in the menu bar and used as a central location for the commonly used scripts. Currently, the library is comprised of a “rag doll” script but users can also add their own frequently used scripts to it.


Figure 4: Library Menu

Customizable Label Fonts

When creating instructional exhibits or animations, text plays an important role in the presentation. In previous versions, the user was only able to edit fonts using Python code to manipulate a wxPython font object. Now, the user can change fonts via the Font dialog box, as shown in Figure 5.


Figure 5: Font Dialog

Sprite Sequence Offset

When the same animated sprite is used for several objects in a model, the animations are in synch by default (see Figure 6). The user can change the rigid bodies’ spriteSequenceOffset property from the object tree (see Figure 5) to make them look more realistic. For example, if you assign the same sprite to two circles with one of the circles having the spriteSequenceOffset set at 3, the canvas will display the fourth sprite for this circle and first sprite for the other one at the first time-step (see Figure 7).


Figure 5: Sprite Sequence Offset


Figure 6: Animated Sprites with spriteSequenceOffset = 0


Figure 7: Animated Sprites with spriteSequenceOffset Set to Different Values


In this version, rigid bodies can be displayed as 3D-like blobs by setting their showBlob property to True. For circles, blobs resemble spheres; for rectangles and polygons, they resemble ellipsoids (see Figures 8 and 9). The following code snippet can be used to show blobs for all rigid bodies in a model.

>>> for rb in system.rigidBodies:
....    rb.showBlob = True

Figure 8: Model with No Blobs


Figure 9: Model with Blobs

“All Connectors” Option in the Hide/Show Menu

The user can hide/show all connectors in a model via this menu option (see Figure 10).


Figure 10: Hide/show All Connectors


Object Tree

In this version, the user can edit individiual properties not only in the object tree itself (see Figure 11) but also by double-clicking on them, which launches an edit dialog box (see Figure 12).


Figure 11: New Object Tree


Figure 12: Edit Dialog

New Conditions in the Behaviors Dialog


Figure 13: New conditions in Automatic Behavior Definitions

New Actions in the Behaviors Dialog

In this version, the following actions are added to the behaviors dialog:

  • Beam connectors can be created when a specified condition is satisfied.
  • Textures can be assigned to rigid bodies.

Figure 14: New actions

New Sprites

We added trees, clouds, and sea shells to the sprites library (see Figures 15, 16, and 17).


Figure 15: Sample of Newly-added Sea Shell Sprites


Figure 16: Sample of Newly-added Tree Sprites


Figure 17: Sample of Newly-added Cloud Sprites

New Tutorials

Now, there are two tutorials showing how two classic puzzles, Minesweeper (re-named as Thornsweeper) and 15-puzzle, can be programmed using Mekanimo (see Figures 18 and 19). The tutorials can be viewed at http://mekanimoquickhelp.s3.amazonaws.com/tutorials/index.html.


Figure 18: Thornsweeper


Figure 19: 15-puzzle

spriteFrameRate, spriteAngle, and spriteAnimate

We added the following sprite control properties:

  • spriteFrameRate controls how fast an animated sprite is played.
  • spriteAngle sets the orientation of the sprite relative to the bounded rigid-body.
  • spriteAnimate is a boolean property that can start and stop a sprite animation.



Paste and paste with offset operations now generate auto-code. The undo/redo for these operations also work properly in this version.

Gravity - Weight Relationship

For consistency, when the gravity vector is updated, the weights of the rigid bodies are automatically updated as well.

Features with No GUI Access

canvas.userDraw Method

This new method enables a user to draw to the canvas while a model is running. We will post a tutorial about this feature soon.

createBox2DCpp Function Covers Box2D Version 2.02

In this version, it is possible to create C++ files for Box2D version 2.02 in addition to version 2.01.

>>> system.createBox2DCpp('c://yourdirectory//test.cpp', version=202)

To create C++ code for version 2.01 use ‘version=201‘.

setJointLimits Utility Function

Now, it is possible to set the joint limits and enable limits in one line of code instead of three.

>>> system.setJointLimits(joint=pin1, upperAngle=pi/2, lowerAngle=0)

The above snippet is equivalent to:

>>> pin1.upperAngle = pi/2
>>> pin1.lowerAngle = 0
>>> pin1.enableLimits = True

setTextureAsSprite Utility Function

After assigning a texture to a rigid body, it is possible to convert the assigned texture to a sprite as shown below.

>>> system.setTextureAsSprite(element=circle1)

Hidden Canvas Modes

These are experimental tools that currently do not have toolbox icons.


This mode is used for creating skeletons. To see how it works, first set the canvas mode to SKELETON as shown below.

>>> canvas.mode = SKELETON

Next, create a chain of connected bones by clicking and dragging the mouse(the same way you would create a polygon). Finally, double-click to finish the segment (this automatically sets the canvas mode to SELECT). If you need to create another segment, you need to set the canvas mode to SKELETON again. Mekanimo automatically creates rounded rectangles (rectangles with welded circles at each end) and connects each segment with torsional-springs.

The code snippet below shows how to change the default bone thickness, torsional-spring stiffness, and damping values.

>>> defaults[SKELETONTHICKNESS] = 2
>>> defaults[SKELETONKTOR] = 800
>>> defaults[SKELETONCTOR] = .2

Figure 20 shows a complete skeleton formed by creating three skeleton segments and attaching them to each other with torsional-springs. Please note that the torsional springs connecting the bones in the same segments are hidden by default.


Figure 20: SKELETON Mode Example


To create flexible beams, first change the canvas mode as shown below.

>>> canvas.mode = FLEXIBLEBEAM

Next, click and drag the mouse to create a rectangular shaped envelope (the same way you would create a rectangle). When you release the left button, Mekanimo will automatically create a series of rectangles with fixed width. Orientation of these rectangles will be determined by the aspect ratio of the envelope.


Figure 21: FLEXIBLEBEAM mode example


Figure 22:Deformed beams

The code snippet below shows how to change the default segment length, torsional-spring stiffness, and damping values. Please note that unlike the SKELETON mode, FLEXIBLEBEAM mode uses the regular torsional-spring defaults and does not have a special default key to set the torsional-spring stiffness and damping values (this is likely to change in the next release). When the torsional-spring stiffness (Ktor) or damping (Ctor) property is set too high, system may become unstable.

>>> defaults[FLEXBEAMSEGLENGTH] = 2
>>> defaults[KTOR] = 800
>>> defaults[CTOR] = .2