I made some experiments with Processing to send data to Cinema 4D with OSC (Open Sound Control) protocol.

Tools you need

  1. Maxon Cinema 4D
  2. fOSC v1.1.1 plug-in for Cinema 4D (https://github.com/fillmember/fOSC)
  3. Processing v3.5.3 (https://processing.org/download/)
  4. oscP5 v0.9.9 library for Processing (https://www.sojamo.de/libraries/oscP5/)
  5. Different Processing libraries depending what you want to do (e.g. Kinect, Leap Motion, The MidiBus)

Processing OSC template
Here is basic Processing example that sends OSC data. In this example sketch generates a window where mouse position is captured and then remapped to more nice values for Cinema 4D (y-axis is flipped and sketch middle point is the origin) and then data is send with OSC.

import oscP5.*; // Import oscP5 library
import netP5.*; // Import oscP5's net library

OscP5 osc; // Declare oscP5 object
NetAddress net; // Declare net address object

void setup() { // Sketch basic settings
  size(640, 640); // Set sketch window size (width, height)
  osc = new OscP5(this, 6449); // Set new OscP5 object
  net = new NetAddress("127.0.0.1", 32000); // Set new net address
}

void draw() { // Processing will run this function constantly
  clear(); // Clear window every frame
  float posX = mouseX; // Get mouse x-position
  float posY = mouseY; // Get mouse y-position
  circle(posX, posY, 25); // Draw circle to mouse position
  float x = map(posX, 0, width, (width/2.0)*-1, width/2.0); // Remap x value
  float y = map(posY, 0, height, height/2.0, (height/2.0)*-1); // Remap y value
  send(x, y); // Run send function
}

void send(float value_a, float value_b) {
    OscMessage message_1 = new OscMessage("Mouse Position"); // Initialize new OSC message
    message_1.add(value_a); // 1st x-position
    message_1.add(value_b); // 2nd y-position
    osc.send(message_1, net); // Send OSC message
}

With fOSC plug-in you want to listen to port 32000.

fOSC makes null object for every individual OSC message and you can assign position and rotation parameters to message using add() method. Then you can use Xpresso to remap those values to whatever you want to.

Cheat sheet

  1. value controls X-position.
  2. value controls Y-position.
  3. value controls Z-position.
  4. value controls H-rotation.
  5. value controls P-rotation.
  6. value controls B-rotation.

Example sketch:
Track brightest pixel from webcam and send that via OSC

Updated 14/04/2019

Cinema 4D, Experimental, Processing