Jump to content
  • Advertisement
Sign in to follow this  

PhysX NxCapsuleController and upDirection

This topic is 2934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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


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:

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;


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?


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!