Character Controller crash

Character Controller crash

Hi, I am having some problems with havok physics which I use in my first-person shooter project.I have got proxy character controllers to represent the players in the game and the issue is when I am firingagainst them (for the moment I use simple box as bullets), it happens that once the player has been hit I automatically delete the bullet (box) from the scene, certainly I am interested in the reaction after the impact however, after the box is removed the game crashes and the log states the following:

hkpCollisionDispatcher.inl<46>: Assert : unsigned < HK_MAX_SHAPE_TYPE >You can only access type between [0..31]hkpNullAgent.cpp<45>: Warning : Have you called hkpAgentRegisterUtil::registerAllAgents? Do not know how to make linear casting between HK_SHAPE_CAPSULE and types.hkpCollisionDispatcher.inl<46>: Assert : unsigned < HK_MAX_SHAPE_TYPE >You can only access type between [0..31]hkpNullAgent.cpp<45>: Warning : Have you called hkpAgentRegisterUtil::registerAllAgents? Do not know how to make linear casting between HK_SHAPE_CAPSULE and types.I can see that the character controller doesn't know that the box is gone and probably is still calculating the impact effect. The truth is that quite long time ago I haven't had any issue and things were working perfectly after removing the entity which suggest me that I may have changed some parameters that affect the way havok internaly peforms collisions.../////////////////////////////////////////////////////////////////////////////void HavokPhysics::RemoveCollisionObject( const hkpCollidable * removeMe ){ m_dynamicsWorld->lock(); // first remove the object from the physics system // To retrieve the owner of a particular hkpCollidable, we can query the // hkpCollidable type (with hkpCollidable::getType()). This is either set // to hkpWorldObject::BROAD_PHASE_ENTITY (indicating a hkpRigidBody) or // hkpWorldObject::BROAD_PHASE_PHANTOM (indicating a hkpPhantom). Then we // can safely cast the void* returned from hkpCollidable::getOwner() method. if (removeMe->getType() == hkpWorldObject::BROAD_PHASE_ENTITY) { hkpRigidBody* rigidBody = static_cast(removeMe->getOwner()); m_dynamicsWorld->removeEntity( rigidBody ); } else if (removeMe->getType() == hkpWorldObject::BROAD_PHASE_PHANTOM) { hkpPhantom* phantom = static_cast(removeMe->getOwner()); m_dynamicsWorld->removePhantom( phantom ); } m_dynamicsWorld->unlock();} // HavokPhysics::RemoveCollisionObject(removeMe)I always refresh the manifold before the character controller is integrated by calling checkSupport hkVector4 down; down.setNeg4(up); controller->checkSupport(down, input.m_surfaceInfo); // Apply the character state machine { m_actorContexts[aid]->update(input, output); } //Apply the player character controller { // Feed output from state machine into character proxy controller->setLinearVelocity(output.m_velocity); hkStepInfo si; si.m_deltaTime = m_timestep; si.m_invDeltaTime = 1.0f/m_timestep; controller->integrate( si, m_dynamicsWorld->getGravity() ); } // blockAny help would be appreciated. Thanks

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

Hi,

Can you post the callstack at the time of the assert?

Cormac

Sure, 00000001() QuakeGaraged.exe!hkpMoppAgent::staticLinearCast(const hkpCdBody & bodyA=, const hkpCdBody & bodyB=, const hkpLinearCastCollisionInput & input=, hkpCdPointCollector & collector=, hkpCdPointCollector * startCollector=) Line 191 C++ QuakeGaraged.exe!hkpSymmetricAgentLinearCast::staticLinearCast(const hkpCdBody & bodyA={...}, const hkpCdBody & bodyB={...}, const hkpLinearCastCollisionInput & input={...}, hkpCdPointCollector & collector={...}, hkpCdPointCollector * startCollector=0x0012f610) Line 91 + 0x5 bytes C++ QuakeGaraged.exe!hkpSimpleShapePhantom::setPositionAndLinearCast(const hkVector4 & position={...}, const hkpLinearCastInput & input={...}, hkpCdPointCollector & castCollector={...}, hkpCdPointCollector * startCollector=0x0012f610) Line 146 + 0x3a bytes C++ QuakeGaraged.exe!hkpCharacterProxy::integrateImplementation(const hkStepInfo & stepInfo={...}, const hkVector4 & gravity={...}, hkpCharacterProxyIntegrateCommand * command=0x00000000, hkpAllCdPointCollector & castCollector={...}, hkpAllCdPointCollector & startCollector={...}) Line 962 C++ QuakeGaraged.exe!hkpCharacterProxy::integrate(const hkStepInfo & stepInfo={...}, const hkVector4 & worldGravity={...}) Line 316 C++> QuakeGaraged.exe!HavokPhysics::VKinematicCharacterMove(const irr::core::vector3d & rotation={...}, const irr::core::vector3d & direction={...}, const irr::core::vector2d & shift={...}, unsigned long aid=10667083) Line 1363 C++ 00000001() QuakeGaraged.exe!hkpMoppAgent::staticLinearCast(const hkpCdBody & bodyA=, const hkpCdBody & bodyB=, const hkpLinearCastCollisionInput & input=, hkpCdPointCollector & collector=, hkpCdPointCollector * startCollector=) Line 191 C++QuakeGaraged.exe!hkpSymmetricAgentLinearCast::staticLinearCast(const hkpCdBody & bodyA={...}, const hkpCdBody & bodyB={...}, const hkpLinearCastCollisionInput & input={...}, hkpCdPointCollector & collector={...}, hkpCdPointCollector * startCollector=0x0012f610) Line 91 + 0x5 bytes C++ QuakeGaraged.exe!hkpSimpleShapePhantom::setPositionAndLinearCast(const hkVector4 & position={...}, const hkpLinearCastInput & input={...}, hkpCdPointCollector & castCollector={...}, hkpCdPointCollector * startCollector=0x0012f610) Line 146 + 0x3a bytes C++QuakeGaraged.exe!hkpCharacterProxy::integrateImplementation(const hkStepInfo & stepInfo={...}, const hkVector4 & gravity={...}, hkpCharacterProxyIntegrateCommand * command=0x00000000, hkpAllCdPointCollector & castCollector={...}, hkpAllCdPointCollector & startCollector={...}) Line 962 C++QuakeGaraged.exe!hkpCharacterProxy::integrate(const hkStepInfo & stepInfo={...}, const hkVector4 & worldGravity={...}) Line 316 C++> QuakeGaraged.exe!HavokPhysics::VKinematicCharacterMove(const irr::core::vector3d & rotation={...}, const irr::core::vector3d & direction={...}, const irr::core::vector2d & shift={...}, unsigned long aid=10667083) Line 1363 C++hope this help

Thanks.

It looks like the crash is happening when the character capsule shape tries to move against the landscape (which would be the Mopp mentioned in the callstack there).
From the crash log this seems to be because the collision dispatcher doesn't have a collision agent entry for Mopps and capsules.

It's safe to assume that the character was moving around on the landscape previously, so it seems as if the collision agent was somehow removed.
I'm not sure under what circumstances this can happen.

Or, maybe the shapeType of the landscape shape is getting corrupted somehow.
Again, I'm not sure how this could happen.

Unless maybe the landscape object is getting deleted...

Have you called hkpAgentRegisterUtil::registerAllAgents on startup?
Are you sure the body you're passing to RemoveCollisionObject() is the bullet?

Maybe try just moving the bullet somewhere for now rather than deleting it. Does the crash still happen?

Hi, thanks for the reply- Yes, I have calledhkpAgentRegisterUtil::registerAllAgents on startup after creating the dynamic world (hkpWorld).- I have checked that all removed agents were just bullets neither the characters nor the landscape.I tried not to remove any object at all and everything worked fine even when I was shooting other agents the bullet just bounced off. Now instead of removing the object I shiffted it as you suggested and things still doesnt work. But now I found out some weard bugs in which sometimes when two agents collide each other it crash (but not every execution), I am not sure if I misplacedhkpAgentRegisterUtil::registerAllAgents but I am going to try different things just to see if it was some small issue.

I'm also doing a fps but I'm using a raycast instead of firing rigid bodies.
Whydon't youuse raycast to detect the collision of the bullets?

Leave a Comment

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