Error at hkaAnimatedSkeleton.sampleAndCombineAnimations()

Error at hkaAnimatedSkeleton.sampleAndCombineAnimations()

Sorlaize's picture

I've got multiple animations imported as in the Character Animation demo, which just plays different skinned animations. I can use

context->m_animatedSkeleton->getDeltaReferenceFrame()

without problems. I can also ease animations in/out.

I want to draw the deformed mesh, so like in the demo, I'm doing this:

	hkaPose* pose = new hkaPose(m_context->m_animatedSkeleton->getSkeleton());

	// Get the pose based on the character controller and state
	// Gets the pose from the girl, based on controller position
	// Sample the active animations and combine into a single pose
	m_context->m_animatedSkeleton->sampleAndCombineAnimations( pose->writeAccessPoseLocalSpace().begin(), pose->writeAccessFloatSlotValues().begin() ) ;

When I step through it doesn't throw an exception while fetching the values from pose, only afterwards.

Any idea what might be causing this? I've already messed with the animation data and read the user guide on this, but there isn't much detail. I wouldn't think it's to do with having only one animation active.

Thanks.

12 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
sean.thurston's picture

Hi Sorlaize,

Are you building in debug or release? I am wondering if this is an assert or an exception. If it is an assert, can you say which assert it is? Also, can i get a callstack for when the assert/exception occurs?

Let me know what you come up with.

Thanks,
Sean

Developer Support Engineer Havok www.havok.com
jbrindle's picture
Quoting - sean.thurston

Hi Sorlaize,

Are you building in debug or release? I am wondering if this is an assert or an exception. If it is an assert, can you say which assert it is? Also, can i get a callstack for when the assert/exception occurs?

Let me know what you come up with.

Thanks,
Sean

If it's an assert in debug mode, check the debug output window. It will usually have a message that starts with "HAVOK:"

If you can find that, it may help you figure out what is going on.

Sorlaize's picture

It's an exception: An unhandled exception of type 'System.AccessViolationException'

It does the same in release mode, and it still throws an exception if I call the same code in either my Update or Draw routines. The callstack is just Game.Draw().

I'm pretty sure the animation data is OK; I'm skinning my mesh to a set of bones (no float slots) but the Havok user guide seems to indicate they're optional.

Sorlaize's picture

I've also tried adding a breakpoint where a Havok error is fired, but it doesn't break, so I'm not getting an error message from Havok.

I'm not using the code for asserts, and I'm not sure how to find them..none are being written to the console.

Sorlaize's picture

Here is some information from debugging:

http://img84.imageshack.us/img84/9500/animation2da6.png

Sorlaize's picture

I'm sure my animation data is fine when importing:

http://img215.imageshack.us/img215/6584/animation3rc6.png

Sorlaize's picture

Ok, I found out it only throws an exception if I try to ease in animations, but when I use my .hkx animations and mesh in the Character Animation demo, it works fine.

But if I try to ease in that same animation in my own project, it again throws the exception. I can ease it in, in a different place in the code inside Update, and it works. But not straight away after the animation was loaded.

sean.thurston's picture

Hi Sorlaize,

I'm glad you got it working for the most part. Would you mind posting your Game.Draw() or which ever method was causing the assert? Sorry, but I wasn't able to come up with anything from your previous posts.

Have you tried looking at the EaseCurvesDemo? It shows a good example of how to do easing.

Thanks,
Sean

Developer Support Engineer Havok www.havok.com
gjunker's picture
Quoting - sean.thurston

Hi Sorlaize,

I'm glad you got it working for the most part. Would you mind posting your Game.Draw() or which ever method was causing the assert? Sorry, but I wasn't able to come up with anything from your previous posts.

Have you tried looking at the EaseCurvesDemo? It shows a good example of how to do easing.

Thanks,
Sean

I have a similar issue, HK660R1. In Debug (haven't tried Release yet), using code from the normal blending demo, I get an exception at this call stack:

Katana.exe!hkaSampleAndCombineUtils::blendNormalFloat(hkaSampleAndCombineUtils::FloatBlendParameters & paramsIn={...}, float * accumulationInOut=0xcccccccc, float * accumulatedWeightsInOut=0x00000011) Line 100 + 0x11 bytes C++ Katana.exe!hkaAnimatedSkeleton::sampleAndCombineInternal(hkQsTransform * poseLocalSpaceOut=0x01ecb700, unsigned int numBones=17, float * floatSlotsOut=0x00000000, unsigned int numFloatSlots=0, hkaChunkCache * cache=0x00000000, bool partial=false) Line 444 C++ Katana.exe!hkaAnimatedSkeleton::sampleAndCombineAnimations(hkQsTransform * poseLocalSpaceOut=0x01ecb700, float * floatOut=0x00000000, hkaChunkCache * cache=0x00000000) Line 66 C++

As you might expect from that call stack, the exception is an access violation:

First-chance exception at 0x0091587e in Katana.exe: 0xC0000005: Access violation reading location 0xcccccccc. Unhandled exception at 0x0091587e in Katana.exe: 0xC0000005: Access violation reading location 0xcccccccc.

The code in question is basically the code from the demo:

// sample the animation hkaSkeleton* pSkeleton = pRig->getSkeleton(); const int boneCount = pSkeleton->m_numBones; hkaPose pose(pSkeleton); pInst->sampleAndCombineAnimations( pose.accessUnsyncedPoseLocalSpace().begin(), pose.getFloatSlotValues().begin() );

I'm not using anything special -- single animation, no float tracks, 17 bones, no easing in/out, full weight on the animation. The anim and the rig loaded from the packfile just fine.

I get the same crash in the same place for the same reason with the HavokGirl rig and one of the anims (run loop I think).

Any thoughts?

Thanks
Greg
gjunker's picture

Apologies for the formatting above -- and apparently you cannot edit posts in these forums. So, I'll repost it here with proper formatting and avert your eyes at the post above. ;)

*******************

I have a similar issue, HK660R1. In Debug (haven't tried Release yet), using code from the normal blending demo, I get an exception at this call stack:

Katana.exe!hkaSampleAndCombineUtils::blendNormalFloat(hkaSampleAndCombineUtils::FloatBlendParameters & paramsIn={...}, float * accumulationInOut=0xcccccccc, float * accumulatedWeightsInOut=0x00000011) Line 100 + 0x11 bytes C++
Katana.exe!hkaAnimatedSkeleton::sampleAndCombineInternal(hkQsTransform * poseLocalSpaceOut=0x01ecb700, unsigned int numBones=17, float * floatSlotsOut=0x00000000, unsigned int numFloatSlots=0, hkaChunkCache * cache=0x00000000, bool partial=false) Line 444 C++
Katana.exe!hkaAnimatedSkeleton::sampleAndCombineAnimations(hkQsTransform * poseLocalSpaceOut=0x01ecb700, float * floatOut=0x00000000, hkaChunkCache * cache=0x00000000) Line 66 C++

As you might expect from that call stack, the exception is an access violation:

First-chance exception at 0x0091587e in Katana.exe: 0xC0000005: Access violation reading location 0xcccccccc.
Unhandled exception at 0x0091587e in Katana.exe: 0xC0000005: Access violation reading location 0xcccccccc. 

The code in question is basically the code from the demo:

// sample the animation
hkaSkeleton* pSkeleton = pRig->getSkeleton();
const int boneCount = pSkeleton->m_numBones;
hkaPose pose(pSkeleton);
pInst->sampleAndCombineAnimations(pose.accessUnsyncedPoseLocalSpace().begin(), pose.getFloatSlotValues().begin());


I'm not using anything special -- single animation, no float tracks, 17 bones, no easing in/out, full weight on the animation. The anim and the rig loaded from the packfile just fine.

I get the same crash in the same place for the same reason with the HavokGirl rig and one of the anims (run loop I think).

Any thoughts?

Thanks
Greg

gjunker's picture

NM -- I was not keeping a ref around for the packfile data (using in-place loading, with local-scope reader).

Login to leave a comment.