I think about new hkpRigidBody

I think about new hkpRigidBody

Sometime i run the project get this error""""""::::: "The at the 0x0069b14a EmptyProject.exe unhandled exception: 0xC0000005: reading location 0x00000000 access violation occurs" or not i want to know how to  deal with it.

call stack:

> EmptyProject.exe!hkVector4::setXYZ_0() Line 657 + 0xe bytes C++
EmptyProject.exe!hkSweptTransform::initSweptTransform() Line 26 C++
EmptyProject.exe!hkMotionState::initMotionState() Line 16 C++
EmptyProject.exe!hkpMotion::init() Line 41 C++
EmptyProject.exe!hkpMotion::hkpMotion() Line 29 C++
EmptyProject.exe!hkpKeyframedRigidMotion::hkpKeyframedRigidMotion() Line 16 + 0x19 bytes C++
EmptyProject.exe!hkpFixedRigidMotion::hkpFixedRigidMotion() Line 16 + 0x17 bytes C++
EmptyProject.exe!hkpRigidBody::hkpRigidBody() Line 227 + 0x3f bytes C++
EmptyProject.exe!C3DComponent::CreateBoxBody() Line 136 + 0x37 bytes C++
EmptyProject.exe!C3DComponent::CreateRigidBody(float _massVal, C3DComponent::PhysicType _physicType, bool _bDynamic) Line 69 C++
EmptyProject.exe!CShooterGame::OnInitialize() Line 75 C++
EmptyProject.exe!CGame::Run() Line 189 + 0xe bytes C++
EmptyProject.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, HINSTANCE__ * __formal, HINSTANCE__ * __formal) Line 33 + 0x8 bytes C++

[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]

create body function :

void C3DComponent::CreateBoxBody()
if(Com_pPhyWorld == NULL)
if(Com_pBoundingShape->boundType != BoundType::BoundingTypeBox)

//get boundingbox size 
hkReal a=(((BoundingBox*)Com_pBoundingShape)->_max.x)-(((BoundingBox*)Com_pBoundingShape)->_min.x);
hkReal b=(((BoundingBox*)Com_pBoundingShape)->_max.y)-(((BoundingBox*)Com_pBoundingShape)->_min.y);
hkReal c=(((BoundingBox*)Com_pBoundingShape)->_max.z)-(((BoundingBox*)Com_pBoundingShape)->_min.z);

hkVector4 vecHalfExtent(PixcelToMeter(a/2),PixcelToMeter(b/2),PixcelToMeter(c/2));


hkpConvexShape* shape = new hkpBoxShape(vecHalfExtent,0);

if (Com_bDynamic)
Com_RigidBodyInfo.m_mass = Com_mass;
hkMassProperties massProperties;

Com_RigidBodyInfo.m_mass = massProperties.m_mass;
Com_RigidBodyInfo.m_centerOfMass = massProperties.m_centerOfMass;
Com_RigidBodyInfo.m_inertiaTensor = massProperties.m_inertiaTensor;
Com_RigidBodyInfo.m_solverDeactivation = Com_RigidBodyInfo.SOLVER_DEACTIVATION_MEDIUM;
Com_RigidBodyInfo.m_shape = shape;
Com_RigidBodyInfo.m_motionType = hkpMotion::MOTION_BOX_INERTIA;
Com_RigidBodyInfo.m_qualityType = HK_COLLIDABLE_QUALITY_KEYFRAMED;
Com_RigidBodyInfo.m_position = D3DToHavok(this->act_Location);
Com_RigidBodyInfo.m_shape = shape;
Com_RigidBodyInfo.m_mass = 0.0f;
Com_RigidBodyInfo.m_motionType = hkpMotion::MOTION_FIXED;
Com_RigidBodyInfo.m_qualityType = HK_COLLIDABLE_QUALITY_FIXED;
Com_RigidBodyInfo.m_position = D3DToHavok(act_Location);

Com_pRigidBody = new hkpRigidBody(Com_RigidBodyInfo);


6 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

It looks like you are trying to access some memory that hasn't been initialised properly(and is pointing to null). The callstack indicates that it is something used in hkVector4::setXYZ_0(), most likely, the input parameter which is the position from the hkpRigidBodyCinfo.

Try to find which rigid body is causing this crash (the callstack you gave says it is a rigid body with MOTION_FIXED). Then check what value Com_RigidBodyInfo.m_position has when you try to create this body. Also check your D3DToHavok(...) function to make sure it is correctly creating a hkVector4.

Also, was it intentional that your dynamic rigid body uses "D3DToHavok(this->act_Location);" but your fixed rigid body uses "D3DToHavok(act_Location)"?

Amy Developer Support Engineer Havok www.havok.com

here is 

hkVector4 D3DToHavok(D3DXVECTOR3& _val)


hkVector4 val;

val(0) = _val.x;

val(1) = _val.y;

val(2) = _val.z;

val(3) = 0.0f;

return val;


the act_Location is D3DXVECTOR3(0,0,0) and Com_RigidBodyInfo.m_position(0)=0.0 (1)=0.0 (2)=0.0 (3)=0.0

all body can get this error ,act_Location is the properties of the base class and the physicbody i just use some functions to create,so "act_Location" mean "this->act_Location" i think error not here,form the stack may be aboout the motion,but where i don't know,so i need help,

Hi Will,

Is the callstack always the same when you get this error? Does the callstack often/always have a hkVector4 function at the top when errors occur?

Usually, problems that occur during object construction are caused by the construction trying to use bad data that it was given by the user. So if you can reliably reproduce this problem, please check the values of Com_RigidBodyInfo when the rigid body is created to check whether they are (or are not) causing the problem.

Amy Developer Support Engineer Havok www.havok.com


i'm sorry this time is busy,i try use this code to Initialization Com_RigidBodyInfo , sometime get a new error or not,Whether it is multi-threaded  make this error and old error?i have uploaded the file about Havok can help me find it?

Com_RigidBodyInfo.m_shape = shape;
hkMassProperties massProperties;
hkpInertiaTensorComputer::computeShapeVolumeMassProperties(shape, boxMass, massProperties);


> EmptyProject.exe!hkVector4::setSelect() Line 227 + 0x16 bytes C++
EmptyProject.exe!hkVector4::setSelect<2>() Line 272 C++
EmptyProject.exe!hkMatrix3Util::_getDiagonal() Line 139 C++
EmptyProject.exe!hkpRigidBody::createDynamicRigidMotion() Line 143 + 0x10 bytes C++
EmptyProject.exe!hkpRigidBody::hkpRigidBody() Line 248 + 0x6e bytes C++
EmptyProject.exe!C3DComponent::CreateBoxBody() Line 152 + 0x37 bytes C++
EmptyProject.exe!C3DComponent::CreateRigidBody(float _massVal, C3DComponent::PhysicType _physicType, bool _bDynamic) Line 69 C++
EmptyProject.exe!CShooterGame::OnInitialize() Line 106 C++
EmptyProject.exe!CGame::Run() Line 189 + 0xe bytes C++
EmptyProject.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, HINSTANCE__ * __formal, HINSTANCE__ * __formal) Line 33 + 0x8 bytes C++
EmptyProject.exe!__tmainCRTStartup() Line 275 + 0x2c bytes C
EmptyProject.exe!WinMainCRTStartup() Line 189 C


Did you get the SIMD or non-SIMD version? If callstack always has a hkVector4 function at the top, try downloading Havok with a different SIMD version and see if this error is still happening.

Amy Developer Support Engineer Havok www.havok.com

Accedere per lasciare un commento.