Character floats above surface.

CrazyLegz

17-06-2009 16:02:03

Hi,

I'm not sure if this is the right place to ask this question since it isn't directly related to NxOgre (although I am using it), but I thought there are some physx experts around here and the nvidia developer forums aren't really very active, so I hope the forum moderators won't mind.
Here's my post on nvidia which doesn't get much replies: http://developer.nvidia.com/forums/index.php?showtopic=3272

I'm using a capsule character controller.
When I place my character above a surface along with some boxes, everything falls down like it's supposed to. Only my character stops just before it hits the surface, and floats a little distance above the surface. In the character demo I saw that the character also floats a little distance above the ground. Does anyone know why this is? And how I can manipulate this distance?

A screenshot is attached to this message.

And for the sake of completeness, here a code snippet as how I instantiate the capsule controller descriptor.


NxCapsuleControllerDesc description;
description.setToDefault();
description.position.x = position.x;
description.position.y = position.y;
description.position.z = position.z;
description.height = height;
description.radius = radius;
description.skinWidth = 0.1;
description.slopeLimit = std::cosf(NxMath::degToRad(45.0f));
description.stepOffset = 0.5;
description.upDirection = NX_Y;
description.climbingMode = CLIMB_CONSTRAINED;//CLIMB_EASY
description.callback = this;


Thanks in advance,

Crazylegz.

betajaen

17-06-2009 17:40:11

It's the "stepOffset" and "skinWidth", but when I looked at your picture I knew why. Your using a really bad model for representing characters. The person who created the model didn't bother to correct set the origin point properly. So naturally the figure sits 0.5m off the ground.

CrazyLegz

17-06-2009 18:29:02

Thanks for your reply betajean.
I've played with the stepoffset and skinwidth properties and played with meshmagick to change the point of origin on y-axis of the model but it doesn't seem to have effect. Even when using other models. But if you look at the screenshot, the model does fit in the capsule in terms of height.
It really is the physx capsule itself that floats, if I set the stepoffset 0.1 it doesn't seem to change anything. If I increase the height of the capsule it starts to float higher. Am i missing something?

betajaen

17-06-2009 19:51:25

That is a little strange, I have had the characters look like they have been walking on the floor before. Perhaps; you can fake it by adjusting the -y coordinate of the SceneNode so the feet touch the ground, but physically he does not.

CrazyLegz

17-06-2009 21:17:14

I've already tried that, but it just doesn't feel right :) and the physical capsule would stick out above the character.

CrazyLegz

18-06-2009 13:39:14

I found some consistency... The height it floats above the surface is the radius + skinwidth.

So I changed my code to the following:

description.height = height - (radius * 2);

// and

double y = m_nxController->getPosition().y - 0.01; // 0.01 is the skinwidth, hardcoded for testing.


And now the model touches the ground, but the physical capsule is to small now.
Please take a look at the screenshot of this message and notice the characters head.