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!
NPC character entity
NPC character entity
Last edited by Orentz on Sat Jun 06, 2009 1:50 pm, edited 1 time in total.
Re: NPC character entity
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.
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.
Re: NPC character entity
Wouldn't using a character controller for 30+ entities be slow?
Re: NPC character entity
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).
Re: NPC character entity
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