Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
Emmanuel Dafflon
Emmanuel Dafflon's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Shape.getVertexY returning always same data ?
[3 Replies]
02-Oct-2013 01:05 AM
Forum:
Programming Questions
Hello,
I'm making some test with a cube I created, I'm trying to detect the side facing bottom or top or ...
But when I use the getVertex or getVerterX/Y/Z I always get the same value from the vertices even if my cube is moving and rotating.
My cube :
void createCube() {
s = createShape();
s.beginShape(QUAD);
s.fill(col, alpha);
//bottom
s.vertex(-size/2, -size/2, size/2);
s.vertex(size/2, -size/2, size/2);
s.vertex(size/2, -size/2, -size/2);
s.vertex(-size/2, -size/2, -size/2);
//left
s.vertex(-size/2, -size/2, -size/2);
s.vertex(-size/2, -size/2, size/2);
s.vertex(-size/2, size/2, size/2);
s.vertex(-size/2, size/2, -size/2);
//top
s.vertex(-size/2, size/2, -size/2);
s.vertex(size/2, size/2, -size/2);
s.vertex(size/2, size/2, size/2);
s.vertex(-size/2, size/2, size/2);
//front
s.vertex(-size/2, size/2, size/2);
s.vertex(-size/2, -size/2, size/2);
s.vertex(size/2, -size/2, size/2);
s.vertex(size/2, size/2, size/2);
//right
s.vertex(size/2, size/2, size/2);
s.vertex(size/2, -size/2, size/2);
s.vertex(size/2, -size/2, -size/2);
s.vertex(size/2, size/2, -size/2);
//back
s.vertex(size/2, size/2, -size/2);
s.vertex(size/2, -size/2, -size/2);
s.vertex(-size/2, -size/2, -size/2);
s.vertex(-size/2, size/2, -size/2);
s.endShape();
}
void update()
{
translate.add(speed);
position.add(translate);
}
void display() {
pushMatrix();
s.translate(translate.x/frameRate,translate.y/frameRate,translate.z/frameRate);
translate.set(0,0,0);
s.rotateX(rot.x/frameRate);s.rotateY(rot.y/frameRate);s.rotateZ(rot.z/frameRate);
rot.set(0,0,0);
shape(s);
popMatrix();
}
When I try a s.getVertexY/... I get always the same thing...
What am I doing wrong ?
Best regards,
E.D
«Prev
Next »
Moderate user : Emmanuel Dafflon
Forum