void dCollisionConeNodeInfo::CalculateInertiaGeometry (dScene* const world, dVector& inertia, dVector& centerOfMass) const
{
	NewtonWorld* const newton = world->GetNewtonWorld();
	NewtonCollision* const shape= NewtonCreateCone(newton, m_radius, m_height, 0, &m_matrix[0][0]);
	CalculateGeometryProperies (shape, inertia, centerOfMass);
	NewtonDestroyCollision(shape);
}
예제 #2
0
void dCollisionBoxNodeInfo::CalculateInertiaGeometry (dScene* world, dVector& inertia, dVector& centerOfMass) const
{
	NewtonWorld* newton = world->GetNewtonWorld();
	NewtonCollision* box = NewtonCreateBox(newton, m_size.m_x, m_size.m_y, m_size.m_z, 0, &m_matrix[0][0]);
	CalculateGeometryProperies (box, inertia, centerOfMass);
	NewtonReleaseCollision (newton, box);
}
void dCollisionConeNodeInfo::CalculateInertiaGeometry (dScene* world, dVector& inertia, dVector& centerOfMass) const
{
	NewtonWorld* newton = world->GetNewtonWorld();
	NewtonCollision* box = NewtonCreateCylinder(newton, m_radius, m_height, 0, &m_matrix[0][0]);
	CalculateGeometryProperies (box, inertia, centerOfMass);
	NewtonReleaseCollision (newton, box);
}
예제 #4
0
dCollisionBoxNodeInfo::dCollisionBoxNodeInfo(NewtonCollision* box)
	:dCollisionNodeInfo () 
{
	NewtonCollisionInfoRecord record;
	NewtonCollisionGetInfo(box, &record);
	_ASSERTE (record.m_collisionType == SERIALIZE_ID_BOX);

	dMatrix& offsetMatrix = *((dMatrix*) record.m_offsetMatrix);
	SetName ("box collision");
	m_size = dVector (record.m_box.m_x, record.m_box.m_z, record.m_box.m_y); 
	SetTransform (offsetMatrix);
	SetShapeId (record.m_collisionUserID);

	CalculateGeometryProperies (box, m_geometricInertia, m_geometricCenterAndVolume); 
}
dCollisionCompoundNodeInfo::dCollisionCompoundNodeInfo(NewtonCollision* const compound)
	:dCollisionNodeInfo () 
{
	NewtonCollisionInfoRecord record;
	NewtonCollisionGetInfo(compound, &record);
	dAssert (record.m_collisionType == SERIALIZE_ID_COMPOUND);


	dMatrix& offsetMatrix = *((dMatrix*) record.m_offsetMatrix);
	SetName ("compound collision");

	SetTransform (offsetMatrix);
	SetShapeId (record.m_collisionUserID);

	CalculateGeometryProperies (compound, m_geometricInertia, m_geometricCenterAndVolume); 
}
dCollisionConeNodeInfo::dCollisionConeNodeInfo(NewtonCollision* const cylinder)
	:dCollisionNodeInfo () 
{
	NewtonCollisionInfoRecord record;
	NewtonCollisionGetInfo(cylinder, &record);
	dAssert (record.m_collisionType == SERIALIZE_ID_CONE);

	dMatrix& offsetMatrix = *((dMatrix*) record.m_offsetMatrix);
	SetName ("cone collision");

	m_radius = record.m_cone.m_radio;
	m_height = record.m_cone.m_height;

	SetTransform (offsetMatrix);
	SetShapeId (record.m_collisionUserID);

	CalculateGeometryProperies (cylinder, m_geometricInertia, m_geometricCenterAndVolume); 
}