NPC character entity

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Orentz
Posts: 10
Joined: Sun Apr 05, 2009 7:02 pm

NPC character entity

Post by Orentz »

Hi norbo!

what would you say be the best way to represent an npc (walking man for example) as a physical entity?

I want it to collide with objects/terrain but I don't want him to slip down the hills to much.
and I want to have a good control over him using A.I.

I thought about using a box with high friction, with only y-axis rotation allowed. is there a better way?


Thanks!
Last edited by Orentz on Sat Jun 06, 2009 1:50 pm, edited 1 time in total.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: NPC character entity

Post by Norbo »

You could indeed use a simple shape and change the velocities according to input (I'd probably use a Capsule with a zeroed out inverse inertia tensor so it can't rotate at all). If you want more finesse, you'd need some sort of character controller. An example of this can be found in the demos project. Basically, a character controller identifies supports that can be stood upon and props the character up and allows for very directly controllable motion.

The demos example character controller utilizes a swept cylinder shape to search for things to step on and a capsule for the actual body of the character. There's a chance that I'll be making another version of it soon as well.
Orentz
Posts: 10
Joined: Sun Apr 05, 2009 7:02 pm

Re: NPC character entity

Post by Orentz »

Wouldn't using a character controller for 30+ entities be slow?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: NPC character entity

Post by Norbo »

It depends on the character controller and the platform. On the PC, 30 of the demo character controller shouldn't be a problem. The xbox360 should be OK with it too depending on the rest of the simulation. You could make a simpler controller as well if performance becomes a problem (something like a capsule supported by a single raycast).
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: NPC character entity

Post by Norbo »

Here's a fairly robust and relatively simple (compared to the current) character controller. It uses a single raycast to float above the ground and the movementDirection determines which way it accelerates. The accompanying SimpleCharacterControllerInput.cs is just an input gathering class used in the demos.
Attachments
SimpleCharacterController.zip
(7.04 KiB) Downloaded 279 times
Post Reply