Tie Models to Physics
Posted: Mon Mar 29, 2010 10:37 pm
I've looked through the forum and got a little confused on how to make the model and the physics connect to each other.
I understand the model and the physics model are two seperate entities and the worldmatrix will need to be got from the
physics model and passed to the display model.
I've done the following
cubeModel is a plane Box in .X format
This shows the DisplayModel which is my .x file in the center of the map and the pBox for the physics as the physics entity which moves about.
If i update the DisplayModel's worldMatrix in the Update of my game the box does move with the physics box but it is maked by the rendered physics box.
Hope this made sense.
I'm presuming i'm missing a step to tie the imported .x model to the physics box model.
I will keep looking through the forum as i'm sure this will of been asked before, i just can't find it right now.
I understand the model and the physics model are two seperate entities and the worldmatrix will need to be got from the
physics model and passed to the display model.
I've done the following
cubeModel is a plane Box in .X format
Code: Select all
Box pBox = new Box(new Vector3(0.25f, 1.5f, 1.5f), 1, 1, 1, 1f);
DisplayModel cubeDM = new DisplayModel(cubeModel);
entityDrawer.displayModels.Add(cubeDM);
space.add(pBox);
This shows the DisplayModel which is my .x file in the center of the map and the pBox for the physics as the physics entity which moves about.
If i update the DisplayModel's worldMatrix in the Update of my game the box does move with the physics box but it is maked by the rendered physics box.
Hope this made sense.
I'm presuming i'm missing a step to tie the imported .x model to the physics box model.
I will keep looking through the forum as i'm sure this will of been asked before, i just can't find it right now.