# Help needed for Animation with AnimationCallback: AccessViolationException

This topic is 2758 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,

could someone provide me a small DirectX9 SlimDX sample application that uses an AnimationCallback delegate in animationController.AdvanceTime(...)?

I converted my project (too big to post, sorry) from MDX to SlimDX (DirectX9), but I get an AccessViolationException when calling this.animationController.AdvanceTime(elapsedTime, myAnimCallbackHandler);
The debug runtimes don't tell me anything either and I'm quite lost now.

I'm putting a small structure (myCbData) in the CallbackKey.Data when I create the animation set. In MDX, I had to get an IntPtr to this data by using

 GCHandle handle = GCHandle.Alloc(myCbData, GCHandleType.Pinned); theCallbackKey.Data = handle.AddrOfPinnedObject();

The CallbackKey.Data in SlimDX is still an IntPtr, so I guess my code is still usable (?).

On the other hand, the AnimationCallback delegate in SlimDX now returns the callback data as a System.Object instead of an IntPtr, which seems quite odd. Are the object handles pinned internally? But how to get the IntPtr to my structure then?
Are the animation callbacks fully functional in SlimDX, or is there still some work to do?

Lars

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 30
• 9
• 16
• 12