Collision rule with charactercontroller

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
limeh
Posts: 30
Joined: Sat Apr 30, 2011 7:22 pm

Collision rule with charactercontroller

Post by limeh »

I'm trying to do a 'protective shield' for my character so i created a box over him. The problem is that the character somehow 'teleports' up on to the box when it is created. I've also added the collisionrules for both the character's body and support with the shield but it seems like it has something to do with the way the support works. Are there any ways to make it ignore the shield?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Collision rule with charactercontroller

Post by Norbo »

If you're using the SimpleCharacterController, it doesn't use the body's rules to prune its supports. You can, however, choose to filter based on collision rules by modifying the code in the FindSupport method.
limeh
Posts: 30
Joined: Sat Apr 30, 2011 7:22 pm

Re: Collision rule with charactercontroller

Post by limeh »

would that be modifying this line ?
if (candidate.CollisionRules.Personal >= CollisionRule.NoSolver)

i'm not exactly sure how the find support works but my guess is to add another condition?
limeh
Posts: 30
Joined: Sat Apr 30, 2011 7:22 pm

Re: Collision rule with charactercontroller

Post by limeh »

oh sorry, now the character doesn't teleport up to the box. but the camera sort of zooms in right into the character as if being confined to the bounding box. Is that still something to do with the find support?

-edit-
I figured it out, it was the camera's problem cause its determined using raycast. Thanks! Another question, what is an appropriate way to remove an entity from space? I'm using space.remove and sometimes the game crashes saying unable to remove nullexception. This happens when my fireball hits both the ground and another bounding box at the same time
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Collision rule with charactercontroller

Post by Norbo »

Thanks! Another question, what is an appropriate way to remove an entity from space? I'm using space.remove and sometimes the game crashes saying unable to remove nullexception. This happens when my fireball hits both the ground and another bounding box at the same time
Space.Remove is the proper way to do it, but it sounds like you might be removing from within an immediate event (one with a present-tense, '-ing' name). That is unsupported and will corrupt the state of the engine.

Removing entities was also disallowed from deferred events in v0.15.2, but is supported in the development version (http://bepuphysics.codeplex.com/SourceC ... evelopment).
Post Reply