Help please!! How to make the bone movements of an animated object work (appear) in Processing?
in
Contributed Library Questions
•
8 months ago
I made this object using blender and made its moving (animation) in blender.
The imported object must move as the same way in blender when I click the mouse.
but on clicking the mouse it doesn't move as the same way in blener and the bones movements don't work (appear) properly in processing.
- import processing.opengl.*;
import saito.objloader.*;
OBJModel[] anim;
int animFrames = 20;
int animFrame;
boolean animOn = false;
float rotX;
float rotY;
void setup(){
size(600, 600, OPENGL);
anim = new OBJModel[animFrames];
String filename = "";
for(int i = 1; i <= animFrames; i++){
if(i < 10){
filename =
"Moving_00000"+ i + ".obj";
}else{
filename =
"Moving_0000"+ i + ".obj";
}
anim[i-1] =
new OBJModel(this, filename, "relative", TRIANGLES);
anim[i-1].enableDebug();
anim[i-1].scale(50);
}
noStroke();
}
void draw(){
background(200);
lights();
translate(width/2, height/2, 0);
rotateX(rotX);
rotateY(rotY);
if(animOn){
anim[animFrame].draw();
animFrame++;
if(animFrame == animFrames){
animFrame = 0;
}
}else{
anim[animFrame].draw();
}
rotY = rotY + 0.005;
}
void mousePressed(){
animOn = true;
}
void mouseReleased(){
animOn = false;
}
1