this is the code for that function.
- Code: Select all
void ndBody::SetMatrix(const ndMatrix& matrix)
{
m_equilibrium = 0;
m_transformIsDirty = 1;
m_matrix = matrix;
dAssert(m_matrix.TestOrthogonal(ndFloat32(1.0e-4f)));
m_rotation = ndQuaternion(m_matrix);
m_globalCentreOfMass = m_matrix.TransformVector(m_localCentreOfMass);
}
it is not supposed to change anything other that the matrix. if did it will make the body to no macth what is in the scene.
the matrix of a body used for very few this like the reference for joints
in that function there are two flags: m_equilibrium and m_transformIsDirty
they are set to let the net update know that the status of the body changed.
the first thing in an update is a call to function void ndScene::InitBodyArray()
it this will check those flags and determine if a boy need it aabb to be recalculated and reposition in the scene broad phase.
this happens at line 1350 if file C:....\newton-4.00\sdk\dCollision\ndScene.cpp
you will see that it calls
void ndScene::UpdateAabb(ndInt32, ndBodyKinematic* const body)
it does not check for body mass or anything.
set a break point there as see if after you set the matrix that that function is called.
like I said changing the aabb of a body is a big mistake. because it will try to modify element outside of the body in the scene, what is store in the scene is the aabb of the root shape. so that will also changed.