• Advertisement
Sign in to follow this  

PhysX character controller

This topic is 3896 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 want to have a character controller in PhysX, but I don't know how to create it properly. gPhysicsSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION); if (!gPhysicsSDK) return; gPhysicsSDK->setParameter(NX_SKIN_WIDTH, 0.05); gPhysicsSDK->setParameter(NX_CONTINUOUS_CD, true); gPhysicsSDK->setParameter(NX_CCD_EPSILON, 0.01); NxSceneDesc sceneDesc; sceneDesc.gravity = gDefaultGravity; gScene = gPhysicsSDK->createScene(sceneDesc); NxBoxControllerDesc desc; NxController* c; NxUserAllocatorDefault* myAllocator; myAllocator = new NxUserAllocatorDefault; NxControllerManager* gManager = NxCreateControllerManager(myAllocator); desc.extents = NxVec3(1.0, 1.0, 3.0); desc.upDirection = NX_Z; desc.stepOffset = 1.0; desc.slopeLimit = cosf(NxMath::degToRad(60.0f)); c = gManager->createController(gScene, desc); NxReleaseControllerManager(gManager); That doesn't build, I get this error: Linking... ShopTycoonMain.obj : error LNK2019: unresolved external symbol __imp__NxReleaseControllerManager referenced in function "void __cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z) ShopTycoonMain.obj : error LNK2019: unresolved external symbol __imp__NxCreateControllerManager referenced in function "void __cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z) D:\Documents and Settings\Harrison Ploeg.HARRISON\My Documents\Visual Studio 2005\Projects\ShopTycoon\Release\ShopTycoon.exe : fatal error LNK1120: 2 unresolved externals [Edited by - HarrisonPloeg on June 23, 2007 2:29:05 AM]

Share this post


Link to post
Share on other sites
Advertisement
project properties > linker > input, add: NxCharacter.lib NxCooking.lib NxExtensions.lib PhysXLoader.lib

Share this post


Link to post
Share on other sites
NxU32 collisionFlags;
character->move(NxVec3(cameraPointDirection.x, cameraPointDirection.y, cameraPointDirection.z), -1, 0.001, collisionFlags, 1.0f);
NxExtendedVec3 position;
position = character->getPosition();
cameraPosition.x = position.x;
cameraPosition.y = position.y;
cameraPosition.z = position.z;

That code will compile, but the game crashes when started. What is wrong with it and how do I make the activeGroups parameter, all groups?

[Edited by - HarrisonPloeg on June 27, 2007 3:35:11 AM]

Share this post


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

  • Advertisement