I am making a game that uses blocks modeled in max. I want to give them collision using the box primitive but when i do they are raised above the ground. As in the model is on top of the collision model not centered. I am also having the same problem with TriangleMeshObjects. If i let them spawn without added code they are at the origin, but if i add code ot place them in the world they don't have collision. And yes they are static. Thanks for the help.
This is a bug in your code, it depends on how you're storing positions and rendering but as a general rules create a box like so:
new Box(-0.5F * dimensions, Matrix.Identity, dimensions);
This will centre your box but it's still up to you centre your model.
I am new to collision and all that stuff so let me reexplain my problem. I have created a planeobject as my ground. This is the same one that is created if the heightmap fails. Everything works fine it renders at the origin (0,0,0), but the collision model is maybe 5 units below. Everything falls through the rendered model then hits the invisible collision model.
I am using these to position the model and collision model but it is not working.
collisionSkin.ApplyLocalTransform(new Transform(-com, Matrix.Identity));
I am also having the same problem with the triangleMeshObject as well.
Hmm, are you able to post the rest of your code somewhere (ie. http://pastebin.com/). In order for someone to help you we will need to be able to see how you're rendering your plane. For everything to render correctly your rendered plane's world position and the actual JigLibX collision skin must be located at the same position. That position value that you're using, is it set to Vector3.Zero? Because if your plane is being rendered at world coordinates (0, 0, 0) then the body should also be at (0, 0, 0), in other words try setting position to Vector3.Zero if it isn't already. Make sure this same position is applied to the body and the object you're rendering.