I'm implementing Bepu Physics into my graphics engine for XNA. I simply create a new space lefting all settings to default. Next, i create a simple scene with a static cube for the ground, and 3 dynamic boxes falling down. Here it's the code:
Code: Select all
Space m_Space;
Entity m_staticBox;
Entity m_dynBox1;
Entity m_dynBox2;
Entity m_dynBox3;
void Initialize()
{
m_Space = new Space();
m_staticBox = new Box(new Vector3(0, 0, 0), 400f, 1f, 400f);
m_dynBox1 = new Box(new Vector3(0, 100, 0), 50f, 50f, 50f, 10f);
m_dynBox2 = new Box(new Vector3(0, 200, 0), 50f, 50f, 50f, 10f));
m_dynBox3 = new Box(new Vector3(0, 300, 0), 50f, 50f, 50f, 10f));
m_Space.add(m_staticBox);
m_Space.add(m_dynBox1);
m_Space.add(m_dynBox2);
m_Space.add(m_dynBox3);
}
void Update(GameTime p_GameTime)
{
space.update(GameTime);
Matrix _matrixStaticBox = m_staticBox.orientationMatrix * Matrix.CreateTranslation(m_staticBox.centerOfMass);
Matrix _matrixDynBox1 = m_dynBox1.orientationMatrix * Matrix.CreateTranslation(m_dynBox1.centerOfMass);
Matrix _matrixDynBox2 = m_dynBox2.orientationMatrix * Matrix.CreateTranslation(m_dynBox2.centerOfMass);
Matrix _matrixDynBox3 = m_dynBox3.orientationMatrix * Matrix.CreateTranslation(m_dynBox3.centerOfMass);
}
Could you help me?
Thanks in advance!
Fax3D