draw a textured model

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
hunx
Posts: 4
Joined: Thu Aug 21, 2014 9:49 pm

draw a textured model

Post by hunx »

i know bepu just works with the physics of the models and i need to add the model textures by the common way(something like this)

but i can't merge it with the bepu model draw logic

Code: Select all

            Vector3[] staticTriangleVertices;
            int[] staticTriangleIndices;
            Model model = game.Content.Load<Model>("mymodel");
            ModelDataExtractor.GetVerticesAndIndicesFromModel(model, out staticTriangleVertices, out staticTriangleIndices);
            var staticMesh = new StaticMesh(staticTriangleVertices, staticTriangleIndices, new AffineTransform(new Vector3(0.01f, 0.01f, 0.01f), Quaternion.Identity, new Vector3(0, 0, 0)));
            staticMesh.Sidedness = TriangleSidedness.Counterclockwise;
            Space.Add(staticMesh);
            game.ModelDrawer.Add(staticMesh);
i mean i can't see my model with the common xna method

any ideas?
thanks


EDIT:

i made it, but now my model moves with the camera
i decided to draw in the "DrawUI" method, in the xna code i draw this in the Draw method and the objects are independent from the camera
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: draw a textured model

Post by Norbo »

If the model appears fully stationary relative to the camera, the model may be getting drawn with its world-view-projection matrix only containing a projection. If the same code is producing different results depending on where it is placed, chances are there's some state on the graphics device that is being left uncontrolled, so the draw just inherits whatever the last settings were.

For rendering-specific questions, I'd recommend visiting the other forums (xna, gamedev.net, and so on) since there's more people hanging out there and I don't have any special insight into general rendering questions. :)
Post Reply