How to display and manipulate numerous .obj objects?

edited January 2014 in How To...

I am fairly familiar with Java, but not much experience with computer graphics. I am working on a program that takes in serial data, and uses that to manipulate a 3D hand in Processing. I have a hand model that I split into 15 separate components (for each segment that needs to move) in Blender. I couldn't find a way to deform a complex mesh like this (HE-Mesh was all I found, and it didn't seem like it would do the job). Here's my code:

import saito.objloader.*;
import processing.serial.*;
import processing.opengl.*;

String inputString = "";
boolean stringComplete = false;

Serial port;  // Create object from Serial class
OBJModel hand; //Creates hand object

void setup() {
  size (600, 400, OPENGL); //Sets window size, sets to OpenGL
  String portName = Serial.list()[1]; //Sets port to COM3
  port = new Serial(this, portName, 9600);

  hand = new OBJModel(this, "palm.obj", "t1.obj", "t2.obj", "i1.obj", "i2.obj", "i3.obj", "m1.obj", "m2.obj", "m3.obj", "r1.obj", "r2.obj", "r3.obj", "p1.obj", "p2.obj", "p3.obj");



void serialEvent(Serial port) {
  while (port.available()>0) {
    char inChar = (char); 
    inputString += inChar;
    if (inChar == '\n') {
      stringComplete = true;

void draw() {
 if (stringComplete) {
    int[] data = int(split(inputString, ' ')); //Splits string into an integer array
    inputString = ""; //Clears inputString
    stringComplete = false;

  translate(width/2, height/2, 0);

My first issue is that the OBJLoader only seems to be able to load 1-2 files. (The above code says that the constructor is undefined. If I remove all but any two of them, it will render.) Am I supposed to import them as separate objects? Or, maybe it is supposed to be numerous objects in one file? Also, once I have all of these things imported, how do I move them around? I need to be able to move the fingers individually, but also be able to move the entire hand model. A matrix stack seems to be how this is done, but I don't know how to incorporate that into my code. Finally, does the position of the origin matter when I export from Blender? I have them all centered under the palm currently.

I know it's a long string of questions, thanks for the help.



  • edited January 2014

    *How to display. I proofread all of it except the title, figures.

    And apparently I can edit the title. Just going to go away now.

Sign In or Register to comment.