[0x638A1543] Warning: Failed to shrink the shape (Volume: 0.000000)

[0x638A1543] Warning: Failed to shrink the shape (Volume: 0.000000)

Shape\Convex\ConvexVertices\hkpConvexVerticesShapeConstructor.cpp(139): [0x638A1543] Warning: Failed to shrink the shape (Volume: 0.000000)

I'm getting this warning in my havok simulation and it's bothering me and I feel like I need it fixed so I tried to fix it myself but no luck so hopefully you guys can help.

I have a compound shape in my simulation and this is how I set it up.

hkpStaticCompoundShape* CompoundShape = new hkpStaticCompoundShape();

int vStride = 3 * sizeof(hkReal);

for(int i = 0; i < (int)m_SubMeshes.size(); i++)
{
	hkReal* Vertices = new hkReal[(int)m_SubMeshes[i].Vertices.size() * 3];
	int vc = 0;
	for(int j = 0; j < (int)m_SubMeshes[i].Vertices.size(); j++)
	{
		Vertices[vc + 0] = m_SubMeshes[i].Vertices[j].x;
		Vertices[vc + 1] = m_SubMeshes[i].Vertices[j].y;
		Vertices[vc + 2] = m_SubMeshes[i].Vertices[j].z;
		vc += 3;
	}

	hkStridedVertices stridedVerts;
	{
		stridedVerts.m_numVertices = (int)m_SubMeshes[i].Vertices.size();
		stridedVerts.m_striding = vStride;
		stridedVerts.m_vertices = Vertices;
	}

	hkpConvexVerticesShape::BuildConfig config;
	config.m_convexRadius = 0.001f;

	hkpConvexVerticesShape* VShape = new hkpConvexVerticesShape(stridedVerts, config);

	hkQsTransform trans;
	trans.setIdentity();
	trans.setTranslation(hkVector4(m_SubMeshes[i].Position.x, m_SubMeshes[i].Position.y, m_SubMeshes[i].Position.z));
	CompoundShape->addInstance(VShape, trans);
	VShape->removeReference();
	delete[] Vertices;
}

CompoundShape->bake();

hkpRigidBodyCinfo BodyInfo;
BodyInfo.m_shape = CompoundShape;
BodyInfo.m_motionType = hkpMotion::MOTION_FIXED;
BodyInfo.m_position.set(0.0f, 0.0f, 0.0f);
BodyInfo.m_restitution = 0.4f;
BodyInfo.m_friction = 0.8f;

m_pBody = new hkpRigidBody(BodyInfo);

k_pWorld->addEntity(m_pBody);
CompoundShape->removeReference();

And incase the order I do this all in matters I'll let you know how I do it.

I setup my world and visual debugger etc.

	hkMemorySystem::FrameInfo finfo(500 * 1024);
	m_pMemoryRouter = hkMemoryInitUtil::initDefault(hkMallocAllocator::m_defaultMallocAllocator, finfo);
	hkBaseSystem::init(m_pMemoryRouter, ErrorReport);

	hkpWorldCinfo worldInfo;
	worldInfo.setupSolverInfo(hkpWorldCinfo::SOLVER_TYPE_4ITERS_MEDIUM);
	worldInfo.m_gravity = hkVector4(0.0f, -9.81f, 0.0f);
	worldInfo.m_broadPhaseBorderBehaviour = hkpWorldCinfo::BROADPHASE_BORDER_FIX_ENTITY;
	worldInfo.m_collisionTolerance = 0.001f;
	worldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_CONTINUOUS;
	worldInfo.m_useCompoundSpuElf = true;

	worldInfo.setBroadPhaseWorldSize(1000.0f);
	m_pWorld = new hkpWorld(worldInfo);

	hkpAgentRegisterUtil::registerAllAgents(m_pWorld->getCollisionDispatcher());

	m_pPContext = new hkpPhysicsContext;
	hkpPhysicsContext::registerAllPhysicsProcesses();
	m_pPContext->addWorld(m_pWorld);

	hkArray<hkProcessContext*> contexts;
	contexts.pushBack(m_pPContext);

	m_pVisualDebugger = new hkVisualDebugger(contexts);
	m_pVisualDebugger->serve();

Then I create my compound shape and then I step havok.
What could cause this warning and how do I fix it?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Arturs L.,

I have a few ideas as to why you might be hitting that assert. One possible cause is that the shape you're trying to shrink has little or no volume before you call the constructor for hkpConvexVerticesShape, causing the assert. If you try passing in another shape, do you still hit the assert? If you use a different shape and still hit the assert, would you mind sending me your mesh data so I can try and reproduce it on my end?  (If you have any questions on how to do this check out Common Havok Components->Serialization->Basic Loading and Saving->Saving with hkSerializeUtil in the Havok docs). Serializing the hkGeometry class should look something like this:

hkGeometry* geom = <blah>;
hkSerializeUtil::saveTagfile(geom, hkGeometryClass, hkOstream(FILENAME).getStreamWriter());

-Denmark

Leave a Comment

Please sign in to add a comment. Not a member? Join today