Skip to main content
GameDev.net gamedev.net
🔒 Locked

PhysX NxCapsuleController and upDirection

Started by Shawn876 Oct 6, 2011 at 9:16 AM 0 replies 1.2k views
Original Post
Shawn876
Shawn876
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:

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;


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.
Shawn876
Shawn876
I'm still stuck on this, and I can't find any other posts with this issue.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.