Miarmy Crowd Simulation Documentation (English)
Pairing Placement
1. Create 2 same place node (put to different node)
2. Make the same attribute:
3. Like this:
Notice: if you encounter the "global anti-overlap auto adjustment" issue, please parent one of the place node into the group:
4. Place agents out. It will like this:
5. Use mel command do following step:
a. Get each position of pair 2 agents
b. Get the center position of these 2 agents
c. Create a locator at center position
d. Parent 2 agents into locator
e. Rotate that locator by a random degree in rotate Y
f. Un-parent all agent into world space:
import maya.cmds as cmds
import random
nbAgent = cmds.getAttr("McdPlace0.numOfAgent")
for i in range(nbAgent):
agent0 = "McdAgent" + str(i+1)
agent1 = "McdAgent" + str(i+nbAgent+1)
t0 = cmds.getAttr(agent0 + ".t")
t1 = cmds.getAttr(agent1 + ".t")
tm_x = t0[0][0] + t1[0][0]
tm_y = t0[0][1] + t1[0][1]
tm_z = t0[0][2] + t1[0][2]
aa = cmds.spaceLocator()
loc = aa[0]
cmds.setAttr(loc + ".tx", tm_x * .5)
cmds.setAttr(loc + ".ty", tm_y * .5)
cmds.setAttr(loc + ".tz", tm_z * .5)
cmds.parent(agent0, loc)
cmds.parent(agent1, loc)
randF = random.random() * 360
cmds.setAttr(loc + ".ry", randF)
cmds.parent(agent0, w = True)
cmds.parent(agent1, w = True)
cmds.delete(loc)
7. Select all agents
8. Use Placement, inverse placement
9. Delete the original place node and leave the new created place node.
10. DONE!!
Basefount Technology