Is a Bug?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
endink
Posts: 2
Joined: Sun Feb 06, 2011 7:16 am

Is a Bug?

Post by endink »

Hi, everyone:

i use the physics on my Windows Phone 7 game, and i apply physics to a 3D Models ?

here is code:

Code: Select all

BEPUphysics.StaticTriangleGroup.StaticTriangleGroupVertex[] vertices = null;
            int[] indices = null;
            StaticTriangleGroup.GetVerticesAndIndicesFromModel(this.Model, out vertices, out indices);
            this.m_triangleMesh = new StaticTriangleGroup(new TriangleMesh(vertices, indices));
and i add some debug code for rendering StaticTriangleGroup, i get like this:
Debug1.JPG
Debug1.JPG (11.93 KiB) Viewed 2343 times
it smells like a bug. i want to find and fix this bug by myself, but i have no the source code, so i use Reflector tool to read the code, i find in TriangleMesh.AddMesh method:

Code: Select all

//......................
else
                    {
                        throw new System.FormatException("Unsupported vertex type in mesh.");
                    }
                    Microsoft.Xna.Framework.Vector3.Transform(vector3Arr, ref transform, vector3Arr);
                    vertices.AddRange(vector3Arr);
//......................

if you remove the line :Microsoft.Xna.Framework.Vector3.Transform(vector3Arr, ref transform, vector3Arr);
it worked fine! and like this:
Debug2.JPG
Debug2.JPG (11.05 KiB) Viewed 2343 times
BTW, i want to speak more about this bug and the reason, but my spoken english is not good enough beacuse i am a chinese developer.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Is a Bug?

Post by Norbo »

It is indeed a bug, thanks for the report! It has been fixed for the next build of v0.15.0.

In the mean time, baking in the transformations on meshes, using a custom build-time content processor, or just using an external method to extract vertices would work. The triangle picking sample on the XNA website shows a build-time content processor, and a vertex extractor can be found in the last couple of posts on this thread: http://www.bepu-games.com/forums/viewto ... 072&p=6616 (not for use on WP7 hardware).
Post Reply