Floating character

dbrock

20-01-2008 21:06:55



By just looking at it from this angle, you can tell the character is floating approx 1 meter off the ground. And I know this is so physx can allow your character to climb stairs and such.

I know I can offset the node so that his feet touch the ground, but I don't want there to be invisible collision space ABOVE THE HEAD when I move him down X number of units on the Y-axis.

Some things to note about Robot.mesh (i used meshmagick to set him up):
- He's 5 Meters tall
- His pivot is centered on the Y-axis

When working with capsules, only the X, and Y parameter of the vector are needed for the character params according to NxOgreCharacter.cpp.
CharacterParams cp;
cp.setToDefault();
cp.mType = CharacterParams::CT_Capsule;
cp.mDimensions = NxVec3( size.z /*radius */, size.y * 0.5f /* height */, size.x );


Why is size.z in the "X" parameter? Because the x parameter is what becomes the players radius, and the way my character is rotated in the mesh file, he's facing -X, meaning the Z axis is really his width.

Any help for getting my characters feet to touch the ground, while not having x number of units of un-filled model space inside the capsule would be greatly appreciated.

betajaen

20-01-2008 21:38:12

It doesn't matter which way the character is facing, the radius would be still the same also the size is in local space (to the character).

The empty space is called the Step Offset, it can be pre-configured in the params (CharacterParams::mStepOffset) and by default it's 0.5, PhysX will try it's very best to keep the character at least 0.5 metres of the ground, so you shouldn't have to worry much about the character's feet sinking into the ground.

dbrock

20-01-2008 21:40:41

But if the character is only 1meter wide, and 2meters in depth, wouldn't that affect the radius?

betajaen

20-01-2008 21:56:22

Yes, the width of the character is radius * 2

dbrock

20-01-2008 21:59:59

Yeah exactly, so the reason why I figured the way the character is facing (inside the mesh) being important is because if hes facing -X, his width ( Z value from bounding box ) would be different then if he was facing -Z (making the X value from bounding box become the width that you want).

dbrock

20-01-2008 23:33:29

The empty space is called the Step Offset, it can be pre-configured in the params (CharacterParams::mStepOffset) and by default it's 0.5, PhysX will try it's very best to keep the character at least 0.5 metres of the ground, so you shouldn't have to worry much about the character's feet sinking into the ground.

Sorry, I must have described what I meant by empty space wrong. I don't mean the space below the character, I mean the space that would be created, when the characters node moves down to have his feet touch the ground, there would be empty space from the top of the models head, to the top of the capsule. The empty space inside the capsule =).

betajaen

20-01-2008 23:47:44

Then you just take away the step offset from the height of the character.