1
\$\begingroup\$

today I want to ask a question about Havok Physics 2012.

My havok version is 2014.1.0-r1 (x86 SIMD version), and I'm using Visual Studio 2012 on Windows 8.

My problem is, that once I add a rigid body to the world, the next time I call hkpWorld::stepMultithreaded(), it breaks in some SSE math related function and gives me this error message through my error report function.

C:\NightlyJobs\09-07-Sun-01\Source\Common/Base/Math/Vector/Sse/hkSseVector4Util. inl(307): [0x1FF88F0E] Assert: hkQuaternionf not normalized/invalid!

Here's the stack trace:

(null)(0):'hkDefaultError::message'
(null)(0):'hkError::messageAssert'
(null)(0):'hkVector4UtilImpl::convertQuaternionToRotation'
(null)(0):'hkRotationf::set'
(null)(0):'hkTransformf::setRotation'
(null)(0):'hkSweptTransformUtil::calcTransAtT1'
(null)(0):'hkSweptTransformUtil::_stepMotionState'
(null)(0):'hkRigidMotionUtilApplyForcesAndStep'
(null)(0):'integrateJob'
(null)(0):'hkpMultiThreadedSimulation::processNextJob'
(null)(0):'hkJobQueue::processAllJobs'
(null)(0):'hkpWorld::stepMultithreaded'

Here's how I create and add the rigid body.
It's so basic that I didn't think there would be any room for bizarre error in it...

hkpSphereShape* sphere = new hkpSphereShape(radius);  // radius is 10.0f here.

hkpRigidBodyCinfo rigidBodyInfo;
rigidBodyInfo.m_shape = sphere;

m_RigidBody = new hkpRigidBody(rigidBodyInfo);

world->markForWrite();
world->addEntity(m_RigidBody);
world->unmarkForWrite();
m_RigidBody->removeReference();

I don't set position or rotation of the rigid body myself, so why it breaks in some quaternion related function is beyond me.

I speculated it might be one of those multithreading-related bizarre errors, so I tried changing

m_WorldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_MULTITHREADED;

to

m_WorldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_DISCRETE;

and

m_World->stepMultithreaded(m_JobQueue, m_CpuThreadPool, timeStep);

to

m_World->stepDeltaTime(timeStep);

but the problem persisted.

Do you know something that I could be doing wrong ?
Please tell me in the comments if you need to see some of my other code to help!
Any help would be greatly appreciated, thanks!

\$\endgroup\$
1
  • \$\begingroup\$ I changed my havok to non-SIMD version, and the problem is gone. I tried 16-byte aligned allocations of hkpSphereShape and hkpRigidBody too (instead of just new), so I don't really understand the problem. \$\endgroup\$
    – James0124
    Aug 9, 2015 at 22:08

1 Answer 1

1
\$\begingroup\$

Answering my own question...

It appears that if you're using the SIMD-enabled version of havok, you need to define HK_CONFIG_SIMD=1.

Not setting it with the SIMD-version, and setting it with the non-SIMD-version can both result in a crash.

For future-visitors:
Whichever version of havok you're using, if you encounter SSE-related crashes or errors, make sure you're not accidentally defining or not defining HK_CONFIG_SIMD in your code or in the project settings in your IDE.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .