Character Controller + Static Mesh

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
slicedpan
Posts: 2
Joined: Fri Jun 03, 2011 1:27 pm

Character Controller + Static Mesh

Post by slicedpan »

Hi I'm using the character controller class from the most recent version (I think), however I have a 'level' which is just one big static mesh. The character always seems to have no support and no traction, hence the movement/jumping does not work properly. When I add new physics objects (e.g. a simple box) and then stand on these I get both support and traction. Can someone explain why this is happening or propose a solution? Any help would be much appreciated
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Character Controller + Static Mesh

Post by Norbo »

The v0.15.2 demos use the CharacterController by default, which is partially nonfunctional and only there due to an accident. The SimpleCharacterController, on the other hand, functions on all support types (meshes etc).

The latest development version also includes some modifications to the non-simple CharacterController: http://bepuphysics.codeplex.com/SourceC ... evelopment
It now can walk on all types of meshes, but it was only re-enabled for testing purposes. A character controller rewrite is on its way.
slicedpan
Posts: 2
Joined: Fri Jun 03, 2011 1:27 pm

Re: Character Controller + Static Mesh

Post by slicedpan »

Oh I see.
Ok thanks for your help
JoelB
Posts: 5
Joined: Thu May 19, 2011 5:04 am

Re: Character Controller + Static Mesh

Post by JoelB »

When you say a re-write of the character controller is on the way - how much different will it be compared to the current one? Also, will there still be a SimpleCharacterController?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Character Controller + Static Mesh

Post by Norbo »

how much different will it be compared to the current one?
It depends. There have been a few revisions in the plans as systems/behaviors have improved (particularly convex casts). The main differences will be better behavior in a variety of corner cases and better code quality.

The version that will be included in the demos will still be a fairly stripped version for simplicity. Most likely, it will still always consider Y to be up and have a locked orientation. It probably won't support crouching/prone/climbing/ladder behaviors out of the box. The goal will be robustness on the core character features. I will also take steps to ensure that it isn't that difficult to add things like 6DOF orientation or alternate shapes/motion states, provided that the user understands the concepts and math.
Also, will there still be a SimpleCharacterController?
Yup. The capsule-on-a-stick approach is really good for learning how a character controller works, and since it's simple, it's also easier to modify. The current "CharacterController" class will probably also stick around for example purposes, probably under a different name- it just won't be the default.
Kiatu24
Posts: 5
Joined: Mon Apr 25, 2011 8:25 pm

Re: Character Controller + Static Mesh

Post by Kiatu24 »

Hi Norbo,

I believe I am having a trouble similar to this. However it might just be something I'm missing. I'm using the SimpleCharacterController (newest version) and drawing my character at the capsule's world matrix. I have a box as the ground (new Box(Vector3.Zero, 30, 5, 30)). The character falls and lands on the ground safely but the IsSupported and HasTraction variables are both false at all points. I have added both the Controller and capsule to the space and the ground is as well. Is there something special I have to do with the ground to make it detectable for the controller? If you need me to specify on anything I can, any help would be greatly appreciated.

Thanks in advance,
Kiatu24
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Character Controller + Static Mesh

Post by Norbo »

Is there something special I have to do with the ground to make it detectable for the controller? If you need me to specify on anything I can, any help would be greatly appreciated.
It should just work. The simple character controller does not care if the support is an entity or not. I could take a closer look at a stripped down repro case if you wanted.

By the way, the more robust character I referred to in this thread is now done. It's in the v0.16.2 development version: http://bepuphysics.codeplex.com/SourceC ... evelopment

I am also trying to get v0.16.2 fully tested and prepared for a stable release tonight, within the next 3 hours or so.
Kiatu24
Posts: 5
Joined: Mon Apr 25, 2011 8:25 pm

Re: Character Controller + Static Mesh

Post by Kiatu24 »

Yeah I might have to upgrade to the Character Controller.

I've attached a simpler version of my game (mostly just the parts that matter to this question). I'm printing out the position of the capsule and whether or not it's supported. It's always false and after a few seconds, the capsule comes to a stop. Any insight on this would be great :) .

Thank you,
Kiatu24
Attachments
Game2.cs
(1.77 KiB) Downloaded 627 times
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Character Controller + Static Mesh

Post by Norbo »

It looks like you're manually handling the various properties instead of calling character.Activate(). The activate method does all that and more; using it should fix the issue. The character object itself still has to be added to the space, though.

Edit: Alright, I missed some things- it appears adding the character controller should auto-activate.

However, because the character's body was manually added, it assumes everything else was already added too. So removing the superfluous additions should do the trick. You do not need to call activate manually.
Kiatu24
Posts: 5
Joined: Mon Apr 25, 2011 8:25 pm

Re: Character Controller + Static Mesh

Post by Kiatu24 »

Thank you!

That was the problem, and the controller.IsUpdating was true so the code in the activate method wasn't getting called. It works beautifully. I really appreciate it.

Thanks for the help,
Kiatu24
Post Reply