GROUP PShape with sphere [solved]

edited December 2014 in How To...

hello all,

I just teach myself PShape with the great tutorial.

  • I want to make a cloud with one big base sphere (wide and flat) and 2 spheres upon.

  • I encounter some problems.

using createShape (SPHERE) I wanted to to pass 6 params, 3 for pos and 3 for size (w,h,d). But it occured to me I can pass only one numerical parameter, size. So to make a flat base sphere for the cloud proves difficult.

2nd I wanted to place the two smaller spheres upon the main part (like a camel looking cloud). But then, I need the 2 spheres have a offset in their Position from 0,0,0 - how when I can't pass pos as params?

this is important since I wanted to use GROUP finally to have the cloud as one shape. For the group I'd need the 3 spheres at different positions.

thank you!

Chrisir ;-)



  • my code is similar to this

    // Make the parent shape
    PShape alien = createShape(GROUP);
    // Make two shapes
    PShape head = createShape(ELLIPSE, 0, 0, 50, 50);
    PShape body = createShape(RECT, 0, 50, 50, 100);
    // Add the two "child" shapes to the parent group
    // Draw the group
    translate(width/2, height/2);
  • Answer ✓


  • edited December 2014


    use createShape (SPHERE) with one parameter (size), then use scale and translate to modify

    PShape head = createShape(SPHERE, 50);
    head.scale(1.0, 0.7, 1.0); 
    • for fill and stroke: head.setStroke and head.setFill (gotta use color type!)

    • for noFill and noStroke: head.setStroke(false) and head.setFill(false)


Sign In or Register to comment.