How to match charactercontroller with XNAnimation

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
cygnus
Posts: 2
Joined: Fri Feb 12, 2010 7:01 pm

How to match charactercontroller with XNAnimation

Post by cygnus »

Hi,

I'm trying to use BEPU with the XNAnimation library and everything seems to work except the collision detection. I assigned my charactercontroller to the player and updating its position by using: characterController.body.moveTo(player.Position);

I've created the charactercontroller with the following statement:
characterController = new CharacterController(correctedPosition, 10, 4.5f, 20f, 1.4f, .01f, .04f);
and my 'level data' as a StaticTriangleGroup.
Both are assigned to my space and I added an event to the charactercontroller using:
characterController.body.eventManager.addEventHook(new BEPUphysics.Events.EventHandlerInitialCollisionDetected(handlePlayerCollision));

When I draw the entities with the entitydrawer I see them collide but the event is not raised. Any idea what I have forgotten?

PS: Is there any good tutorial on how to mix XNAnimation and BEPU together?

Kind regards,

Cygnus
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How to match charactercontroller with XNAnimation

Post by Norbo »

That setup should call the event. In a quick test, it worked. If you could provide some more snippets of the initialization code it might help.

While it shouldn't affect the event, it's good to keep in mind that moveTo will teleport the entity. It can 'moveTo' through anything and into anything regardless of collisions since collisions work at the velocity level (with a little position correction). I think you might already be aware of this given that you plan to 'handlePlayerCollision,' but just in case.

I'm not aware of any tutorial specifically on using XNAnimation and BEPUphysics together. While I'm not intimately familiar with the XNAnimation library, I will try to help with questions about the integration as much as I can.
Post Reply