Sign in to follow this  
Shawn876

PhysX NxCapsuleController and upDirection

Recommended Posts

Hi,
I am currently trying to implement something similar to the 'SampleCharacterController' example in the PhysX SDK with a capsule controller.

Background:

I have multiple PhysX scenes in my spherical world, spaced out via a patch system (sections of the world). These scenes do not use fixed axis systems (i.e. have arbitrary up vectors which are not axis aligned).
I have created terrain PhysX meshes for all of the terrain in my scenes, and I have a vehicle controller which works quite well using them.

The problem:

I noticed there was an 'upDirection' required to be specified in the descriptor of the capsule controller.
When i set the upDirection to a specific aligned axis (NX_X/ NX_Y/ NX_Z), I notice that my controller will hit the terrain tri-meshes and get resolved strangely (trying to move along the real Y axis I assume?).
The capsule itself when visually displayed in debug mode (and using one of the fixed up axis enum's) will be on an undesirable angle.
The gravity vector for each scene, is resolved to be the scenes origin on the surface, heading towards the centre of the planet.

descriptor setup code example:
[code]
NxCapsuleControllerDesc desc;
desc.position.x = scenePosition.x;
desc.position.y = scenePosition.y;
desc.position.z = scenePosition.z;
desc.radius = 1.0f;
desc.height = 2.0f;
desc.upDirection = NX_Y; <------- Issue here
desc.slopeLimit = 0.0f;
desc.skinWidth = 0.0001f;
desc.stepOffset = 0.5f;
desc.callback = NULL;
[/code]

Questions:

Why can't the controller resolve terrain penetration by just using the scenes current gravity vector?
Is there a way I can use this controller with this arbitrary no axis aligned system?

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this