I need this ear to be flush with the head. I want to merge it with the head like how you can merge shapes in Inkscape or Illustrator. I can’t do this by just making everything one shape using vertices and beginShape() and all that because this is part of a character creator and the user will have the option of picking different heads and different ears, so I don’t want to have a big 2D switch case thing where I have defined each possible combination of head and ears. I want to be able to draw the head, draw the ears, and have them merge somehow.
The solution that comes to mind is drawing the ears and head with double the normal stroke weight, and then draw both again but this time with no stroke. This would look okay, but it feels redundant. There’s gotta be a solution that doesn’t require me drawing the same thing twice.
Dang I guess ur right. Tho if I’m doing that, since the p5 stroke is always centered on the line I think, won’t it cut off half of the stroke? So that’s why I proposed when first drawing the head, doing it with double it’s intended stroke weight. I could be mistaken tho
So this is the solution I went with, which I mentioned in my first post so I guess it’s more of a realization that there is no other way lol.
draw the head with double the stroke weight
draw the ear with normal stroke weight
draw the head again but with no stroke
I can even make this easier by making a function that draws the head and use a boolean argument to tell it whether or not to draw it with normal, double, or no stroke.
Lolll I’ve been asking lots of questions recently, thanks y’all for putting up with my shenanigans haha
size(600, 600);
// Make the parent shape
PShape groupShape = createShape(GROUP);
// Make two shapes
PShape ear = createShape(ELLIPSE, 0, 95, 50, 50);
ear.setStroke(false);
PShape head = createShape(RECT, 0, 50, 100, 100);
head.setStroke(false);
// Add the two "child" shapes to the parent group
groupShape.addChild(ear); // the order is important here!!
groupShape.addChild(head);
// modify alien - won't work
groupShape.setStroke(true);
groupShape.setStroke(color(110, 1, 1));
groupShape.setFill(color(110, 1, 1));
//alien.stroke(0);
// Draw the group
translate(width/2, height/2);
shape(groupShape);