Processing 2 Maya _ UDP Communication

Simple test on UDP communication between Processing and Maya. The resulting system works quite well and really fast with up to 250 agents, above that limit it slows down a bit, but it still good (I’ve tested it with up to 2000 agents, and it still works, even if quite slow…).

The flocking script is based on Jose Sanchez’s example “flocking_01” for the Plethora library ( www.plethora-project.com)
The Python script is based on the examples of UDP communication from the Python wiki (http://wiki.python.org/moin/UdpCommunication)

p5toMaya_tracing
INSTRUCTIONS (Available also in the Processing script)

– open Maya and load the ‘processingToMaya_UDP_lineTracing.py’ file in the script editor.
– check that the ‘IP port’, ‘bufferSize’ fields are the same in the two scripts, and that the ‘numElements’ field in the Python script has the same value that the ‘numParticles’ field in Processing
– define the value of ‘curveStep’, in order to define the resolution of the final trajectory curves.
– run the Processing script and press ‘u’ to start the UDP stream.
– run the Phyton script. It should start to stream the Processing particles into Maya.
– if Maya is giving you a ‘10400 error’, you need to increase the value of ‘bufferSize’ in both the scripts, or you need to check that all the values set above are the same in the two scripts.
– when you want to stop the stream, go to the Processing window and press ‘u’ again.
– in the Maya script editor you should get a message ‘stream stopped’. If this does not happen, try to restart and restop the stream for processing. Do not try to do anything in Maya before getting the message, otherwise the software will crash.
– once stopped the stream, you’ll find in Maya one polyCube object for each Processing particle and a curve describing the particle trajectory.
– if you do not want to have the trajectories curves,comment out all the lines after ‘sock.close()’ in the Python script and run the scripts again.

Link to the files:
https://www.box.com/s/214ec9a9e5d1f81fc829

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s