Example #1
0
void NiGeometryData::Transform( const Matrix44 & transform ) {
	Matrix44 rotation = Matrix44( transform.GetRotation() );

	//Apply the transformations
	for ( unsigned int i = 0; i < vertices.size(); ++i ) {
		vertices[i] = transform * vertices[i];
	}
	for ( unsigned int i = 0; i < normals.size(); ++i ) {
		normals[i] = rotation * normals[i];
	}
	CalcAxisAlignedBox(vertices, center, radius);
}
Example #2
0
void bhkTransformShape::CalcMassProperties(float density, bool solid, float &mass, float &volume, Vector3 &center, InertiaMatrix& inertia)
{
    center = transform.GetTranslation();
    mass = 0.0f, volume = 0.0f;
    inertia = InertiaMatrix::IDENTITY;
    if (shape != NULL)
    {
        Matrix44 transform_transposed = transform.Transpose();
        shape->CalcMassProperties(density, solid, mass, volume, center, inertia);
        center = transform * center;

        Matrix44 tm(inertia.Submatrix(0, 0));
        Matrix44 im = transform_transposed * tm * transform;
        inertia = InertiaMatrix(im.GetRotation());
    }
}