Miarmy Crowd Simulation Documentation (English)

UV Pin

UV Pin

Sometimes we want to simulate a group of bugs crawling on the arm/hand, and the arm/hand are still deforming. At this time, we can use the UV Pin Tool. We can pin the agents onto the deforming object, and these agents can still performing their logic behavior and movement, all of their locomotion will be calculated in the UV space.



UV Pin

Logic Sentences and usage

UV Pin

  • use UV pin me to:??
  • unpin me from any object

 
For pin our agents on the surface of mesh is extremely simple, we just need one output channel.

Such as when our node active, the output "use UV pin me to:pSphereShape2" can pin our agents onto the mesh which name is "pSphereShape2"

If you need to detach from object, we need another decision node and when node inputs activate, use output decision: unpin me from any object



Under the hood

Before we execute the UV Pin, the agents may not on the surface of deforming object, like the following picture shown (blue dot stand for agents, and the red curve stand for a piece of mesh surface). So our system firstly will find out the shortest distance from agent to the surface, and calculate out the closest point on the surface. Please notice the surface MUST be polygon mesh, and CANNOT be NURBS or Subdivision Mesh.
In the below image, if we execute the UV Pin, our system will firstly find out the closest points the yellow dots on the surface, and then pin our agents onto it.



Find the closest point on the surface and pin to it


In the below image, when our agents were pinning onto the surface, at that moment, we'll store the UV coordinate into the memory of each agent, and then always pin them on the surface, so the UV map MUST be very good!



Pin to the surface


After pinning on the surface, our agent will always onto it even there are movement, the agent will move in world space and automatically update the UV coordinate and then still perfect pin onto it, each frame in the McdBrainPost, we will deal with those pin behavior. 
Additionally, all the logic perceptions and some output behaviors are still working, such as sound logic, bound logic and spot, also the action can playback well.



Agents moving on the surface







Basefount Technology