Character Controller and Physics.Ignore()

Just for fun, I’m making a game about hunting raptors from helicopters. I’m using a CharacterController to move my raptor around, and then when the player hits it the physics rig takes over.

The ragdoll rig is set isKinematic=true and detectCollisions=false while the raptor is alive.

I want to use the ragdoll rig for collision detection with the world for accuracy and feel reasons. However, when I set detectCollisions back to true the CharacterController no longer moves. Telling it ignore all of the ragdoll colliders via Physics.Ignore() doesn’t resolve the situation.

Is CharacterController doing raycasts or other things internally to move around? Any tips?

Here’s the rig (when detectCollisions=true it just floats in midair):

Never mind–most of my problems have been solved by using OnControllerColliderHit() instead of OnCollisionEnter() to detect collisions with the Character Controller. Should have noticed that earlier!

I’d still be interested to know if it’s possible to have the Character Controller ignore collisions with specified objects, though…

I still can’t get it working reliably. Sometimes you can push the raptors for a few seconds before the collision is detected.

http://www.flashbangstudios.com/tests/chopper4/

Should I just switch over to a rigidbody with fixed rotation?

Here’s what I’m using to detect hits with objects that should kill it:

	// when our collider bumps into something
	void OnControllerColliderHit (ControllerColliderHit col)
	{
		// only care about moving objects
		if (col.rigidbody == null)
			return;

		// did we hit a kill object?		
		foreach(Rigidbody rb in Game.instance.KillObjects)
			if(rb == col.rigidbody)
				GameKilled();
	}

Looks really awesome.

The character controller doesnt support ignore collision right now.

Why not make raptor colliders a trigger, when not in ragdoll mode.

If you want all collisions between box and character controller.You need to support both oncontrollercolliderhit and oncollisionenter.

Eg. when the character moves into a box it will call oncontrollercolliderhit and ensure they are not penetrating anymore. When the box is simulated, it will call oncollisionenter.

This really looks awesome. Very cool effect on the grass and nicely tuned ragdoll effect on the raptor, just gotta love picking them up with the wrecking ball.

I love it too! Nice!

the moving grass is fantastic - very well executed ; )

Yeah that is really really cool. You should make the raptor have more mass relative to the heli, and make him struggle more. Maybe run away faster and dodge when he hears you coming.

Very cool, and already it is fun! Looking forward to this one :slight_smile:

Thanks for the feedback guys! I didn’t intend to show this so soon; it’s is the result of the game jam we had last weekend. We had a bunch of guys get together to work on projects over two days (the other two playable projects that came out of it are here).

It turns out that hauling raptors around with a Chinook is far more fun than it should be, though, so I’m going to work on completing the game loop as I find more time.

Forest: The raptor actually weighs a bit compared to the helicopter. If you can flip him on top you’ll notice it more–you actually can’t fly up with one sitting on top. The chain of hinge joints for the rope has a bizarre way of reducing the effects of mass, though (I think it’s lost in the dampening).

Nice job! It was much more fun than I would have expected. It is well executed. The helicopter has a nice feel to it. I could not help laughing while playing. You should flesh this out to a complete game, there is so much you could do with this start :smile:

Is that the poser raptor? This has been said before, but there are licensing issues with poser content. Dont mean to be a downer, but…better you know now rather than at your release party…
AC

Nope–custom-modeled and rigged in Maya…

Prreeemo!-

Just didnt want you to get in the s@#%

AC

That’s cool–I appreciate the concern. We’re really careful about rights. I do a lot of work with friends for fun projects like this, but we prefer to pay people outright when something goes commercial (we’ll be doing a web version of I Hate Clowns soon, so paid the artist for his time on that).

Plus, people always act more professional when you’re paying them :wink: