I'm trying to load a simple static mesh (Just a simple test mesh) with the following code.. (Windows Phone SDK)
Code: Select all
Vector3[] vertices = VertexList.ToArray();
int[] indices = FaceList.ToArray();
staticMesh m = new StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, 0, 0)));
space.Add(m);
But any colliding object (such as a falling sphere.. ) pass right through...
I checked the bounding box to compare the volume generated by Bepu with the ones I see in MAX and everything seems to be alright..
I also changed the sidedness.. and this made no diference..
Below is the vertex and face list... in its original XML state.. .
Code: Select all
<FaceList>
<Item>
<FaceNumber>1</FaceNumber>
<Face>1 4 5</Face>
</Item>
<Item>
<FaceNumber>2</FaceNumber>
<Face>5 2 1</Face>
</Item>
<Item>
<FaceNumber>3</FaceNumber>
<Face>2 5 6</Face>
</Item>
<Item>
<FaceNumber>4</FaceNumber>
<Face>6 3 2</Face>
</Item>
<Item>
<FaceNumber>5</FaceNumber>
<Face>7 8 11</Face>
</Item>
<Item>
<FaceNumber>6</FaceNumber>
<Face>11 10 7</Face>
</Item>
<Item>
<FaceNumber>7</FaceNumber>
<Face>8 9 12</Face>
</Item>
<Item>
<FaceNumber>8</FaceNumber>
<Face>12 11 8</Face>
</Item>
<Item>
<FaceNumber>9</FaceNumber>
<Face>1 2 8</Face>
</Item>
<Item>
<FaceNumber>10</FaceNumber>
<Face>8 7 1</Face>
</Item>
<Item>
<FaceNumber>11</FaceNumber>
<Face>2 3 9</Face>
</Item>
<Item>
<FaceNumber>12</FaceNumber>
<Face>9 8 2</Face>
</Item>
<Item>
<FaceNumber>13</FaceNumber>
<Face>3 6 12</Face>
</Item>
<Item>
<FaceNumber>14</FaceNumber>
<Face>12 9 3</Face>
</Item>
<Item>
<FaceNumber>15</FaceNumber>
<Face>6 5 11</Face>
</Item>
<Item>
<FaceNumber>16</FaceNumber>
<Face>11 12 6</Face>
</Item>
<Item>
<FaceNumber>17</FaceNumber>
<Face>5 4 10</Face>
</Item>
<Item>
<FaceNumber>18</FaceNumber>
<Face>10 11 5</Face>
</Item>
<Item>
<FaceNumber>19</FaceNumber>
<Face>4 1 7</Face>
</Item>
<Item>
<FaceNumber>20</FaceNumber>
<Face>7 10 4</Face>
</Item>
</FaceList>
<VertexList>
<Item>
<VertexNumber>1</VertexNumber>
<Vertex>-2002.89 -376.19 3299.9</Vertex>
</Item>
<Item>
<VertexNumber>2</VertexNumber>
<Vertex>0.0 -376.19 3299.9</Vertex>
</Item>
<Item>
<VertexNumber>3</VertexNumber>
<Vertex>2002.89 -376.19 3299.9</Vertex>
</Item>
<Item>
<VertexNumber>4</VertexNumber>
<Vertex>-2002.89 -376.19 -3299.9</Vertex>
</Item>
<Item>
<VertexNumber>5</VertexNumber>
<Vertex>0.0 -376.19 -3299.9</Vertex>
</Item>
<Item>
<VertexNumber>6</VertexNumber>
<Vertex>2002.89 -376.19 -3299.9</Vertex>
</Item>
<Item>
<VertexNumber>7</VertexNumber>
<Vertex>-2002.89 376.19 3299.9</Vertex>
</Item>
<Item>
<VertexNumber>8</VertexNumber>
<Vertex>0.0 376.19 3299.9</Vertex>
</Item>
<Item>
<VertexNumber>9</VertexNumber>
<Vertex>2002.89 376.19 3299.9</Vertex>
</Item>
<Item>
<VertexNumber>10</VertexNumber>
<Vertex>-2002.89 376.19 -3299.9</Vertex>
</Item>
<Item>
<VertexNumber>11</VertexNumber>
<Vertex>0.0 376.19 -3299.9</Vertex>
</Item>
<Item>
<VertexNumber>12</VertexNumber>
<Vertex>2002.89 376.19 -3299.9</Vertex>
</Item>
</VertexList>
And here is how filter the above into a vector3[] and a int[] for use with Bepu..
Code: Select all
public struct phyVertex
{
public int VertexNumber;
public Vector3 Vertex;
}
public struct phyFace
{
public int FaceNumber;
public int[] Face;
}
VertexList = new List<Vector3>();
foreach (phyVertex v in xmlVertexList)
{
VertexList.Add(v.Vertex);
}
FaceList = new List<int>();
foreach (phyFace f in xmlFaceList)
{
FaceList.Add(f.Face[0] - 1);
FaceList.Add(f.Face[1] - 1);
FaceList.Add(f.Face[2] - 1);
}
I also checked the vertex and face numbering... and everything seems right...
All collision models such as Box, Sphere and ConvexHull work fine...