We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,i have this code
import saito.objloader.*;
OBJModel model ;
OBJModel tmpmodel ;
PVector[] PVArray;
float rotX, rotY;
float k = 0.0;
void setup()
{
size(800, 600, P3D);
frameRate(30);
model = new OBJModel(this, "Model2.obj", "absolute", TRIANGLES);
model.enableDebug();
model.scale(100);
model.translateToCenter();
tmpmodel = new OBJModel(this, "Model2.obj", "absolute", TRIANGLES);
tmpmodel.enableDebug();
tmpmodel.scale(100);
tmpmodel.translateToCenter();
frameRate(100);
stroke(255);
noStroke();
}
void draw()
{
background(129);
lights();
translate(width/2, height/2, 0);
//rotX+=0.1;
rotY+=0.01;
//rotateX(rotX);
//rotateY(rotY);
pushMatrix();
for (int i = 0; i < model.getVertexCount (); i++) {
PVector orgv = model.getVertex(i);
PVector tmpv = new PVector();
PVArray[i] = new PVector();
//tmpv.x = mouseY;
//tmpv.y = mouseY;
println(orgv);
tmpv.x = orgv.x *(i*mouseX);
tmpv.y = orgv.y+ (i*0.01) ;
tmpv.z = orgv.z;
tmpmodel.setVertex(i, tmpv);
}
k+=0.01;
popMatrix();
tmpmodel.draw();
}
I have problem with the model.getVertex(i) function,I want to make an array of the PVectors that it gets,so i can manipulate them individualy,with custom functions.and no as a whole object.Do you have any idea?Or u think its better to use PShapeObj?
Thanks in advance
Answers
hello again,i made the sketch with arraylist,but it keeps storing the varible i as one element of the arraylist that pass all the vertices.Any Help please.
Cross-posted: https://www.Reddit.com/r/processing/comments/4ybimn/arraylist_vertice/
Seems similar to the
for ( ; ; )
loop logical problem from:https://forum.Processing.org/two/discussion/17883/trying-to-visualize-breath-as-a-line-graph
yeah i know,i did it because sometimes here noone answers
i will check it
i did this and worked perfect until now,no null pointer exception
pushMatrix()
;hello again,i did this.The array works,but when i printArray(Verts) it returns null,when i println(model.getVertex(i)),i get the Pvectors.
if i declare the array as global variable and then populate it in the for loop like this Verts[i]= model.getVertex(i); i get null pointer exception
vertCount is 12738
hello,again i proceed the sketch to this.Is any way to irritate through the array of PVectors and make them have autonomous movement,because now it moves only the whole object.I want to make the vertices act like particles.