Page 1 of 1

Character Controller FindSupport failing

Posted: Tue May 08, 2012 4:30 am
by Smtih
I'm trying to integrate BEPU physics into a game I've been working on, however I can't get the character controller to work.
I have a simple character controller and it seems that the FindSupport function never returns true, thus my character never has traction.
at the moment I just have my character and a staticmesh terrain.

Anyone got suggestions of what I can try to get this up and running?

Extra Info:
The problem stems from the count of collisionPairCollector.CollisionInformation.Pairs always being 0.
Also I notice that if i start the player in the air, it doesn't fall. Maybe this will help debug the issue too.

Re: Character Controller FindSupport failing

Posted: Tue May 08, 2012 5:02 am
by Norbo
If the support gets itself stuck between the body and the ray, the ray might miss it. Other than that, I can't remember any common failures that would explain that when using the SimpleCharacterController.

However, I would recommend switching to either the SphereCharacterController or CharacterController. They are significantly better.

Re: Character Controller FindSupport failing

Posted: Tue May 08, 2012 5:04 am
by Norbo
Extra Info:
The problem stems from the count of collisionPairCollector.CollisionInformation.Pairs always being 0.
Also I notice that if i start the player in the air, it doesn't fall. Maybe this will help debug the issue too.
Is the character added to the space, and are its constituent parts added to the space properly? In the 1.1 version of the demos, an extra call is required to get the SimpleCharacterController to work if I remember right, or you can set IsUpdating to false in the constructor (like the development version). If that is not set to false, the parts don't get auto-added properly.

Re: Character Controller FindSupport failing

Posted: Tue May 08, 2012 5:12 am
by Smtih
IsUpdating bit did the trick!

Re: Character Controller FindSupport failing

Posted: Tue May 08, 2012 6:47 am
by Smtih
So my character now moves and I've switched to the new character controller, however if the player starts in the air, he doesn't fall?

Re: Character Controller FindSupport failing

Posted: Tue May 08, 2012 2:32 pm
by Norbo
Is there gravity? It's been a while since I've fiddled with v1.1, but I don't think you had to do anything special in it to get CharacterControllers to work, and v1.2 (the development version) works as expected. The CharacterStressTestDemo shows a bunch of characters created and directly added to the Space.

Re: Character Controller FindSupport failing

Posted: Thu May 10, 2012 1:17 am
by Smtih
So I worked out how to add gravity, I've moved to the development version of BEPU and using the full fledged character controller.
Despite the tutorials working flawlessly when Implementing into my engine I can't get traction on my player.

Problem seems to be in find support. Despite colliding with the static mesh fine under gravity, I never get into the part in the update support method that gives me traction.
The contact normal is always (0, -1, 0)
I'm not sure what I could be doing wrong?

Re: Character Controller FindSupport failing

Posted: Thu May 10, 2012 2:17 am
by Norbo
That contact normal sounds reasonable assuming it fell onto a flat plane. Is the character controller object itself properly added to the space? I could take a look at the configuration if you have a concise postable configuration.

Re: Character Controller FindSupport failing

Posted: Thu May 10, 2012 2:30 am
by Smtih
ok, seems it was a problem as I was aligning my models to the bounding volumes using a local offset. I'll just change how I do that.