Miarmy Crowd Simulation Documentation (English)

Aim Constrain

We provided a turn-key aiming feature for the bones of agent, which can drive your agent bone aim to target. There are some subtle features of it.



Aim sentence activated


Preparation for Bone Axis

Before generating the original agent, we need setup our rig. If we want to one of the bone aim to target, we need firstly make sure the aiming axis and up vector. In the following pictures show, before generating original agent, please make sure the X (or Z) axis is the aim axis and the Y axis is the up vector. (Note: the other orient scheme is not support for current version of Miarmy)



The X (or Z) should be aim axis and the Y should be up vector


Aim Sentences Features

The sentence conventions of aiming:

bone:<bone name> aim to:<target name> axis:<Axis & upvector>2D as speed <speed>

bone:<bone name> (percentage) aim to:<target object> axis:<Axis & upvector> as speed <speed>

  • The <Bone Name> should be the segment bone name from agent memory. You can check the real name in agent memory by Miarmy > Agent Viewer
  • The <Axis & upvector> should be the axis of bone which you want to it aim to target, and the up pole vector you choose
  • The <Target Object> name should be the unique name in Maya Scene. The dag nodes with the same name in different hierarchy many cause problems.

For example:

  • bone:eyeL aim to:pSphere1 axis:ZY as speed 0.5
  • bone:Head aim to:pSphere2 axis:ZY as speed 0.5

Once the sentence is activated, the bone which you specified will turn and aim to the target with a rotation speed gradually. This speed is determined by sentence result which range is 0 to 1.
Note: the aim turning process is interpolated by Quaternion, so there is no Gimbal Lock issues.

Gradient Aim

Once the bone wants to aim to target, it will aim to target gradually rather than pointing to target directly. Like the following picture, from default pose, the bone point to the target object gradually, and the speed is depending on the output value. 0 make the bone still, 1 make the bone instant point, the value between 0 and 1 (such as 0.4) make the bone point to target 40% each frame.


Gradually aim to target from default to aim pose


Percentage Aim

We can specify percentage in aim sentence to make the bone aim to right direction but not fully aim to target. For example, we can specify a 60% aim sentence like this, bone:Head (60) aim to:pSphere axis:ZY as speed 0.5, you may notice the bone will approach to the 100% aim pose but not fully aim to target. Finally, it will stand the pose which performs 60% aim direction between the default pose and 100% aim pose.


60% aiming make non-full aim result


Self-restitution

Once the sentence is not true (the default output value of each aim sentence is -0.2) or the sentence result is negative, the bone will resume back to the default pose gradually and automatically.



Resume back to default pose automatically


Aim Space

Aim space is simple. In some case, we just want to the bone aim to target in horizontal space, such as our "neck". Our head can rotate to any directions but our neck can only rotate in some degree in Y axis:


Use 3d for the head whereas 2d for the neck


Aim Target Type

Aim target can be 2 different types, points and curve (shape area). It depends on the target object name which you filled in the decision node.

Fill a transform node makes the agents aim to the point, while fill a curve shape node makes the agents aim to the chosest point from agent to the curve shape.

  • bone:head aim to:pSphere1 axis:ZY as speed 0.5
  • bone:head aim to:curveShape1 axis:ZY as speed 0.5

Hierarchical Aim Mechanism

This process is entire automatically, and here we just explained what is happen under the hood.
When you have multiple bones in the same hierarchy want to aim to the same (or different) target, the order of aim bone may cause problem. Imagine that your hand and arm want to point to the some targets. If your hand point to the target firstly, and then you rotate your arm secondly, after your arm aligning to its target, maybe the previously done hand will not point to right direction.
With Miarmy hierarchical aim mechanism, we firstly collect all aim tasks and then execute them hierarchically. For example in the arm tree, it's definitely arm will aim to target before the hand performing aim.


Multi Targets Choose

Rather than Maya traditional aim constrain, we can make the agent bone to aim arbitrary number of targets, just using simple sentence active:
Let's take a look at the following example directly.
We want to our agents aim to right sphere when they are in blue bound whereas aim to left sphere when they are in red bound.

Just using the bound sentences and the indexing technique, we can easily achieve that.

  • bone:Head aim to:pSphere1 axis:ZY as speed 0.5 (active in red bounding box)
  • bone:Head aim to:pSphere2 axis:ZY as speed 0.5 (active in blue bounding box)



2 different targets can be triggered aim by different conditions


The bone will always aim to the target which makes the output the most activated.





Basefount Technology