Jump to content
  • Advertisement
Sign in to follow this  
hi_ruijun

PhysX: Failed to Create Actor

This topic is 4009 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

Hi everyone, in my project I am using PhysX as my physics engine.But after cooking convex shapes in a seperate application, I failed to create actors. ------------------------------------------------------------------------------ Related codes: NxConvexMeshDesc convexDesc; NxConvexShapeDesc convexShapeDesc; NxBodyDesc bodyDesc; convexShapeDesc.meshData = m_pNx->createConvexMesh(UserStream("physxbox.bin", true)); convexShapeDesc.localPose.t = NxVec3( 0, 0, 0 ); if (convexShapeDesc.meshData) cout<<"Succeed in Loading Data from File>>>>>>>>>>>>>>>>>>>"<<endl; actorDesc.shapes.pushBack(&convexShapeDesc); actorDesc.body = &bodyDesc; actorDesc.density = 1.0f; actorDesc.globalPose.t = nxvec;//position Nxvec3 actorDesc.globalPose.M = nxquat;//orientation quaternion if( actorDesc.isValid() ) cout<<"Actor Description is Valid>>>>>>>>>>>>>>>>>>>>>>>>"<<endl; m_pNxBox = m_pNxScene->createActor(actorDesc); if( m_pNxBox ) cout<<"NxBox Created>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<endl; else cout<<"Failed to Create NxBox>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<endl; -------------------------------------------------------------------------- when running, the message followed is displayed: Succeed in Loading Data from File>>>>>>>>>>>>>>>>> Actor Description is Valid>>>>>>>>>>>>>>>>>>>>>>>> Failed to Create NxBox>>>>>>>>>>>>>>>>>>>>>>>>>>>> Help me, please! Any reply is appreciated!

Share this post


Link to post
Share on other sites
Advertisement
maybe try to implement NxUserOutputStream.. this will help you to find what's wrong...


class PhysXErrorOutput : public NxUserOutputStream
{
public:

void reportError(NxErrorCode e, const char* message, const char* file, int line)
{
cout << "Message: " << message << " File: " << file << " Line: " << line << endl;
}

NxAssertResponse reportAssertViolation(const char* message, const char* file, int line)
{
cout << "Message: " << message << " File: " << file << " Line: " << line << endl;
return NX_AR_CONTINUE;
}

void print(const char *message)
{
cout << "Message: " << message << endl;
}
};




and then use it during creation of physics sdk:


static PhysXErrorOutput gPhysXError;

//[...]

m_PhysicsSDK = NxCreatePhysicsSDK( version, gPhysXAllocator, &gPhysXErrors );

//[...]




[Edited by - dopelganger on October 8, 2007 6:10:46 AM]

Share this post


Link to post
Share on other sites
I don't see anything obviously wrong with that code. So, the only question I can ask is...do you have the PhysX system software (drivers) installed? Not the SDK, but the system software? You must have the driver installed, or you will see runtime problems such as this.

Share this post


Link to post
Share on other sites
Thanks for dopelganger and grhodes_at_work!

To dopelganger: I will have a try.

To grhodes_at_work: I have installed the newest PhysX System Software( PhysX_7.09.13), and those example programs with the PhysX sdk can run without error, so I suppose something must be wrong with my program?

I will try to find out!

Share this post


Link to post
Share on other sites
-_-!!!!!!!

I think I've find the reason. In my program I try to create two or more actors using only one NxActorDesc:
------------------------------------------------------
NxActorDesc actorDesc;
...
m_pNxPlane = m_pNxScene->createActor(actorDesc);
...
m_pNxBox = m_pNxScene->createActor(actorDesc);
...
------------------------------------------------------
I thought, after creating an actor, the actorDesc was not needed any more, so I reused this actorDesc to create another actor, and failed here.
So I guess, this is the reason, hah?

Share this post


Link to post
Share on other sites
-_-!!! PhysX's really eating me!

In the SDK documentary it says:
"...To avoid overly long parameter lists and receive aid in error checking, the SDK uses descriptor classes to pass creation parameters. The descriptor is a temporary variable only needed for the duration of the creation call. You can allocate it as a stack variable. ..."

But in my program, I failed when trying to create two or more actors using one NxActorDesc. Then I added error reporting, as dopelganger suggested. But alas, the runtime error disappeared! I don't know why.

Rookie...
Programmer I = new Programmer;
:-(

Share this post


Link to post
Share on other sites
As you discovered, reusing that descriptor variable shouldn't cause problems. Afraid I can't suggest other possible causes without seeing more of your code. But, at least the error is gone now!?

Share this post


Link to post
Share on other sites
No, he means the code from dopelganger only outputs via cout... Change it so it writes errors to a file. It's a very simple and easy change in the code and you won't lose the runtime errors PhysX is throwing.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!