• Create Account

## Help needed for Animation with AnimationCallback: AccessViolationException

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

No replies to this topic

### #1ManagedJack  Members

Posted 26 March 2012 - 03:49 AM

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?