collisionPolygon not creating vertices with certain points?

Hi everyone,

I’m sure the solution to this is easy, but I cannot figure out why each time I try to pass these points to the collisionPolygon constructor:

        pointz=[]
        pointz.append(Point3(-24, 0, -32))
        pointz.append(Point3(-16, 0, -32))
        pointz.append(Point3(-24, 0, -28))
        pointz.append(Point3(-16, 0, -28))
        for i in range(0,len(pointz),4):
            cs=CollisionPolygon(pointz[i],pointz[i+1],pointz[i+2],pointz[i+3])

To create a collisionPolygon, and ask it to print out cs:

print cs

I get this:

cpolygon, (Plane(0 0 1 0)), 0 vertices In 3-d space:

But if I even change one of the values in the aforementioned points like so:

cs=CollisionPolygon(pointz[i]+0.1,pointz[i+1],pointz[i+2],pointz[i+3])

#pointz[i]+0.1...

Then I get this:

cpolygon, (Plane(-0.707105 0.707108 0 -16.9705)), 4 vertices
  33.7996 -31.9
  28.2842 -32
  33.9411 -28
  28.2842 -28
In 3-d space:
  -23.9 0.1 -31.9
  -20 4 -32
  -24 0 -28
  -20 4 -28

Am I missing something fairly obvious? What’s wrong with passing points like these:


Point3(-32, 24, 28)
Point3(-20, 24, 28)
Point3(-32, 24, 32)
Point3(-20, 24, 32)
cpolygon, (Plane(0 0 1 0)), 0 vertices
In 3-d space:

Point3(-32, 0, 28)
Point3(-20, 0, 28)
Point3(-32, 24, 28)
Point3(-20, 24, 28)
cpolygon, (Plane(0 0 1 0)), 0 vertices
In 3-d space:

Point3(-32, 0, 32)
Point3(-20, 0, 32)
Point3(-32, 24, 32)
Point3(-20, 24, 32)
cpolygon, (Plane(0 0 1 0)), 0 vertices
In 3-d space:

Point3(-32, 0, 28)
Point3(-32, 24, 28)
Point3(-32, 0, 32)
Point3(-32, 24, 32)
cpolygon, (Plane(0 0 1 0)), 0 vertices
In 3-d space:

Point3(-20, 0, 28)
Point3(-20, 24, 28)
Point3(-20, 0, 32)
Point3(-20, 24, 32)
cpolygon, (Plane(0 0 1 0)), 0 vertices
In 3-d space:

To the collisionPolygon constructor? The points themselves coincide with points that go to make up procedural geometry; i.e. each set of four points is a face in a cube; all I want is to create collisionPolygons which have points that share the value of the points in the face of the cube I am making. Why aren’t any vertices generated when I pass points like the ones mentioned above to the cpolygon constructor?

Thanks in advance.

I’m not 100% sure if this is the problem here, but I think you should specify the verts in a in counter-clockwise order.

In the first example you have it like this:

2      3

0      1

Try

3      2

0      1

Or

0      1

3      2

Depending on what way should be the front of the polygon.

Thanks Wezu, I’m still not sure about it, but changing it to this:

3->1->0->2

Does this on asking it to print “cs”:

cpolygon, (Plane(0 1 0 0)), 4 vertices
  16 -28
  16 -32
  24 -32
  24 -28
In 3-d space:
  -16 0 -28
  -16 0 -32
  -24 0 -32
  -24 0 -28

And on asking it to show the collision solid, it draws 4 blue lines to form a rectangle. Wow, I knew the mistake was something so silly, I didn’t know one had to specify the order of points though, anyways, I’ll apply this to other things and if it does work,that was it, thanks so much Wezu! :smiley: