Havok Physics Error: To call getDiag, the length of the linear part must be 1.0f

Havok Physics Error: To call getDiag, the length of the linear part must be 1.0f

Hey all,

I'm doing a test project for a sidescrolling shooter game I'm about to make, and I'm using Havok Physics for the first time. I'm currently trying to create bullets (capsule rigidbodies) from the character's (also a capsule) position when the player presses the mouse button.

But this makes the Havok Physics chrash at the stepMultithreaded call. When I try to create the bullet at a position outside of the character's shape then no crash occurs untill I create a bunch of bullets that collide with each other and adventually trigger the same crash. The output of Havok gives me:

Y:\Build\20120831_122323_PcXsPerpetualKeycode\Source\Physics/ConstraintSolver/Jacobian/hkpJacobianElement.inl(15): [0x75D662FB] Assert: To call getDiag, the length of the linear part must be 1.0f

What could I be doing wrong?

Thanks in advance,
Joris van Leeuwen 

Update: The solution was for me to set the collisionInfo.m_weldingType to hkpWeldingUtility::WELDING_TYPE_NONE; No errors occurred after that.

2 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

I've found out that the error occurs. My level is made out of non-convex platforms that I constructed with hkGeometry and hkpBvCompressedMeshShape. I create planes out of triangles that form a platform for my game.

http://25.media.tumblr.com/01af02709e7b99a282d85193a185b0b0/tumblr_mjxcp0pIPC1s49ul7o2_500.png

I have a character controller walking around that peforms perfectly... but Havok gives the "To call getDiag, the length of the linear part must be 1.0f" error when a bullet (Capsule rigidbody) collides with an edge of a plane (two triangles). Here is the code that I've made to create the level platform (line is a vector list of 2D vectors that represent the platform's shape as a closed line):

hkGeometry geometry;
geometry.m_vertices.setSize(line.size() * 2);
 geometry.m_triangles.setSize(line.size() * 2);
for (unsigned int i = 0; i < line.size(); ++i)
 {
 LTMath::Vector3 v1(line[i].x, line[i].y, PLATFORM_DEPTH/2.0f);
 LTMath::Vector3 v2(line[i].x, line[i].y, -PLATFORM_DEPTH/2.0f);
geometry.m_vertices[i*2].set(v1.x, v1.y, v1.z);
 geometry.m_vertices[i*2+1].set(v2.x, v2.y, v2.z);
int backLeft = i*2;
 int backRight = i*2+1;
 int frontLeft = i < line.size()-1 ? i*2+2 : 0;
 int frontRight = i < line.size()-1 ? i*2+3 : 1;
geometry.m_triangles[i*2].set(backLeft, frontLeft, frontRight);
 geometry.m_triangles[i*2+1].set(backRight, backLeft, frontRight);
 }
Mesh mesh;
 mesh.construct(meshData);
 mesh.Transform.setPosition(position);
 m_platformMeshes.push_back(mesh);
hkpDefaultBvCompressedMeshShapeCinfo collisionInfo(&geometry);
 collisionInfo.m_weldingType = hkpWeldingUtility::WELDING_TYPE_TWO_SIDED;
 collisionInfo.m_convexRadius = hkConvexShapeDefaultRadius;
hkpBvCompressedMeshShape* meshShape = new hkpBvCompressedMeshShape(collisionInfo);
hkpRigidBodyCinfo bodyCollisionInfo;
 bodyCollisionInfo.m_shape = meshShape;
 bodyCollisionInfo.m_motionType = hkpMotion::MOTION_FIXED; 
 bodyCollisionInfo.m_position.set( position.x, position.y, position.z );
hkpRigidBody* meshBody = new hkpRigidBody(bodyCollisionInfo);
PhysicsManager::getWorld()->lock();
 PhysicsManager::getWorld()->addEntity(meshBody);
 PhysicsManager::getWorld()->unlock();
meshBody->removeReference();
 meshShape->removeReference();

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui