Can't get PolygoneShape to draw.

I can't get PolygoneShape to draw correctly. Here is some of my trimmed code:

Code: Select all

         fd.shape = new box2d.b2PolygonShape();
         fd.shape.SetAsBox(w/(scaleFactor*2), h/(scaleFactor*2), box2d.b2Vec2(centerX,centerY),angle*57.2957795);
         ...
         function this.display(){
              //Nothing I put here really works
              //I have tried making an array of vertices but it doesn't work because
              //The shape is detected as an edge (returns 2 when I do GetType) rather than a PolygonShape
         }


What are your suggestions, I've been scratching my head for the past 5 or 6 hours. Also the collision as far as I can tell works great between everything so I can confirm that the positioning of said objects are correct.
I ended up doing it sooo... I'm not gonna be that asshole that just posts "I solved it kthx bye." Here's my solution:

Code: Select all

   
    this.display = function() {
        var pos = scaleToPixels(this.body.GetPosition());
        // Draw it!
        rectMode(CENTER);
        push();
        translate(pos.x,pos.y);
        if(shouldAngleBeNegative==false){
            rotate(angle);
        }
        else{
            rotate(-angle);
        }
        fill(127);
        stroke(0);
        rect(0, 0, w, h);
        pop();
    }
//shouldAngleBeNegative is a boolean based on on the x1y1 vs x2y2.
//angle is based on arcsin

Original thread: https://box2d.org/forum/viewtopic.php?t=10115