### Author Topic: building custom plane: is there an addTriangle() order?  (Read 2877 times)

#### stormp

• byte
• Posts: 38
##### building custom plane: is there an addTriangle() order?
« on: June 14, 2007, 11:24:20 am »
Hi,

I was experimenting with building a custom plane.  Is there any order which the addTriangle() or the vectors must be added?

This works:
Code: [Select]
`objSurface.addTriangle(new SimpleVector(-8.0f,  8.0f, 0.0f),                       new SimpleVector( 8.0f,  8.0f, 0.0f),                       new SimpleVector( 8.0f, -8.0f, 0.0f));objSurface.addTriangle(new SimpleVector( 8.0f, -8.0f, 0.0f),                       new SimpleVector(-8.0f, -8.0f, 0.0f),                       new SimpleVector(-8.0f,  8.0f, 0.0f));`
Where as this doesn't work:

Code: [Select]
`        objSurface.addTriangle(new SimpleVector(-8.0f, 8.0f, 0.0f),                       new SimpleVector( 8.0f,  8.0f, 0.0f),                       new SimpleVector( 8.0f, -8.0f, 0.0f));objSurface.addTriangle(new SimpleVector(-8.0f,  8.0f, 0.0f),                       new SimpleVector(-8.0f, -8.0f, 0.0f),                       new SimpleVector( 8.0f, -8.0f, 0.0f));`

Can someone explain?

Thanks.
« Last Edit: June 14, 2007, 11:27:17 am by stormp »

#### EgonOlsen

• Posts: 12258
##### Re: building custom plane: is there an addTriangle() order?
« Reply #1 on: June 14, 2007, 12:25:26 pm »
Can someone explain?

Quote
The vertices have to be defined counter-clockwise because jPCT backface culls them by default.

Your second code works...it's just that the object will be visible from the other side.

#### stormp

• byte
• Posts: 38
##### Re: building custom plane: is there an addTriangle() order?
« Reply #2 on: June 14, 2007, 12:39:29 pm »
Doh! I cant believe i didn't notice that.  thx.