_ther
May 30, 2018, 10:40am
1
according to Shapes 3D Box - Stroke Documentation i am attempting to add stroke to my box correctly, any of the other functions that I try are working (e.g. the .fill()) but not stroke. i want to be able to have no fill but still have the wireframe of the object showing on screen. Any help?
Box test = new Box(this, 300);
test.stroke(255);
test.strokeWeight(10);
test.fill(color(255,0,0));
test.draw();
1 Like
quark
May 30, 2018, 11:57am
2
You must set the draw mode e.g.
// Show surfaces and edges
test.drawMode(Shape3D.SOLID | Shape3D.WIRE);
You can also use Shape3D.TEXTURE
if you are using images as textures.
2 Likes
_ther
June 1, 2018, 2:11am
3
Thank you!!! time to finish my assignment
_ther
June 1, 2018, 6:04am
4
would you happen to know how i can get the color of an object? in the simplest form,
i.e.
//something like this?
color c = test.shape;
1 Like
quark
June 1, 2018, 11:08am
5
color c = text.fill();
This will work with all shapes except Box because a box can have 6 different colour (one for each face) so it wouldn’t know which one to return.
2 Likes
_ther
June 1, 2018, 5:56am
6
Box test = new Box(this, 300);
test.stroke(255);
test.drawMode(Shape3D.SOLID);
test.draw();
// this is where I'm stuck
color c = test.getColor();
quark
June 1, 2018, 11:14am
7
You have already asked this question so go here to see my answer.
1 Like
_ther
June 5, 2018, 2:09am
8
One more question!
How can I get the type of an object?
i.e…
if (testObject.type == Box){
//do something
} else if (testObject.type == Cone){
//do something different
}
You may try out the operator instanceof
:
if (testObject instanceof Box) { }