Collision

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
tadmiral
Posts: 9
Joined: Thu Oct 07, 2010 10:06 am

Collision

Post by tadmiral »

I have setup a character controller for my character and it works as in it keeps him on the ground but he can walk through walls easily. Any idea why this is happening?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Collision

Post by Norbo »

Here's a few diagnostic questions:

-Does the collision mesh actually match the visuals?
-Is the mesh very large in size (hundreds+ units per triangle)?
-Is the entity body of the character appropriately initialized?
-Is it a SimpleCharacterController or is it a CharacterController?
tadmiral
Posts: 9
Joined: Thu Oct 07, 2010 10:06 am

Re: Collision

Post by tadmiral »

Im using the character controller not the simple one. How do i tell if its initialized? It does react to the environment in a height sense just not on the other axis. The mesh is not that large and i do beleive the collision mesh is a decent size although i do not know how to test this.

Fixed: i wasnt applying movement correctly thanks anyway
tadmiral
Posts: 9
Joined: Thu Oct 07, 2010 10:06 am

Re: Collision

Post by tadmiral »

Now its telling me its not supported even though it is
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Collision

Post by Norbo »

I'm not sure what you mean.

In response to your previous question, the character controller needs to belong to a space in order to function properly. You can examine the CharacterControllerInput and the usage of it by the demos application to see how the addition/removal is handled. The problems you describe could be caused by this.

The size issues I referred to are caused by floating point problems. The collision detection system likes shapes that are fairly normally sized- in the 0.5 to 10 units range (per shape/triangle in mesh). It can handle dimensions outside of that range, but staying within it is very safe.
tadmiral
Posts: 9
Joined: Thu Oct 07, 2010 10:06 am

Re: Collision

Post by tadmiral »

Ok i have had a close look and it seems the body is not getting added to the space only the controller? No idea why this is happening. What i ment is the character was walking on the ground but the isSupported variable returns false and thus is was using airborne movement.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Collision

Post by Norbo »

Look at the CharacterControllerInput constructor. If you aren't using it, it sounds like you're doing something very similar to what it does by default. Inside the constructor, it adds the CharacterController updateable to the space, but deactivates it. This is because in the demos, it only should become active when the user presses 'c'. Activating the character controller (through the CharacterControllerInput's Activate method if you're using it, preferably) should get the character ready to go.
Post Reply