Learning programming with Irrlicht and PhysX

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
xp190
Posts: 8
Joined: Tue Feb 01, 2011 4:37 pm

Learning programming with Irrlicht and PhysX

Post by xp190 »

Howdy

Irrlicht 1.7.2
PhysX 2.8.3

I'm trying to build my programming knowledge by extending the IAnimatedMeshSceneNode with PhysX built in based on the PhysXIrrlicht Implementation example posted a long time ago by Nikolaus Gebhardt

see: http://irrlicht.sourceforge.net/phpBB2/ ... ight=physx

for the code and a discussion.

I'm doing this as a learning exercise so I'm taking it as slowly as possible, and I want to start with nothing more then a simple cube which will react based on PhysX. I was able to do this perfectly fine with OpenGL, but Irrlicht has just so much more to offer, however, I find myself a bit lost in some of the errors I am getting.

Here is one such error which has me stumped, as it references code I did not write, if someone could shed some light as to how to fix this problem I will be very grateful:

Code: Select all

1>  NxAnimatedMeshSceneNode.cpp
1>c:3d\irrlicht\irrlicht-1.7.2\include\irrstring.h(283): error C2451: conditional expression of type 'const irr::scene::IAnimatedMesh' is illegal
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>          c:\3d\irrlicht\irrlicht-1.7.2\include\irrstring.h(218) : see reference to function template instantiation 'irr::core::string<T> &irr::core::string<T>::operator =<B>(const B *const )' being compiled
1>          with
1>          [
1>              T=irr::c8,
1>              B=irr::scene::IAnimatedMesh
1>          ]
1>          c:\3d\projects\irrxcube\irrxcube\nxanimatedmeshscenenode.cpp(775) : see reference to function template instantiation 'irr::core::string<T>::string<irr::scene::IAnimatedMesh>(const B *const )' being compiled
1>          with
1>          [
1>              T=irr::c8,
1>              B=irr::scene::IAnimatedMesh
1>          ]
My guess here is that I am calling on something which is not implemented, but I'm not sure what, and what would be a good way to fix it, implement what I'm missing, or fix what I'm doing wrong, and of course how to go about it.

I am thinking that this error stems from the following line based on the error

Code: Select all

core::stringc oldMeshStr = SceneManager->getMeshCache()->getMeshByName(Mesh);
And it all started happening when I replaced getMeshFileName() with getMeshByName since it is deprecated. The return types of the two functions don't match, but I can't find a way to make them match.

If anyone could point me in the right direction, it would help me out a lot.

Thanking you in advance

xp
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Post by zerochen »

hi

getMeshByName(filepath) returns a IAnimatedMesh*

so you probably must change your code to

Code: Select all

IAnimatedMesh* aAnimMesh = SceneManager->getMeshCache()->getMeshByName(Mesh);
i hope that Mesh is a string

zerochen
Anthony
Posts: 121
Joined: Sun Jan 09, 2011 12:03 pm

Post by Anthony »

xp190 wrote:My guess here is that I am calling on something which is not implemented
True, your trying to assign an IAnimatedMesh to a core::stringc. As there is an operator= defined in the class stringc, it can't handle the IAnimatedMesh.

deprecated is only a warning that will tell that the function will disapear sometime in the future. With this release you will always be able to use it. However it is a good practice to find an alternative way, as you did.

The error log doesn't tell you your problem (as I understand):
getMeshByName: I think you overlooked the word "By" in the function name. Assuming Mesh is an IMesh or SMesh. This function requires a stringc to be passed in and then return an IAnimatedMesh or NULL if no mesh has been found wich has that name.

Code: Select all

IAnimatedMesh* aAnimMesh = SceneManager->getMeshCache()->getMeshByName( "TheMeshItsName" );
nameconvention:
Mesh is usually the name of an IMesh or SMesh throughout all tutorials and sourcecode of Irrlight. Therefore it is good practice to keep it that way so you always know what you're working with.
No :shock: I am no noob, just checking if your not one too :roll:

Thanks to Niko and all others that made Irrlicht possible.
xp190
Posts: 8
Joined: Tue Feb 01, 2011 4:37 pm

Post by xp190 »

Hi again and thanks for your responses.

I tried playing around with this some more but I'm still stuck.

I'll provide the original code which I modified, I think this portion of the code is meant to retrieve the Mesh filename to display somewhere.

Code: Select all

out->addString("Mesh", SceneManager->getMeshCache()->getMeshFilename(Mesh));
Here is what I'm seeing;
addString is a call that takes two arguments each const irr::c8, now irr:c8 is a character type irrlicht uses to my understanding, I haven't checked into this too much yet, but the second argument should be irr::c8 as well, however that's now that getMeshFilename() returns.

Since getMeshFilename() is deprecated, I thought I'd find a different call to get the same result. The non-deprecated equivalent call is getMeshByName() but this, as you guys pointed out returns a pointer to the mesh, and not the mesh name....

So how can I get the Mesh name, or path changed into irr::c8 to make this call work? Is there a way to do this? The debugName seems to be something along those lines, but you have to set it first, and I have yet to figure out where to do this.

Much appreciate your input and help.

Thank you

xp
xp190
Posts: 8
Joined: Tue Feb 01, 2011 4:37 pm

Post by xp190 »

I figured out a way to get around this, but I'm not too sure of what effect this might have, in either case the projects builds now but gives me PhysX related run time errors.

I'll have to check with the PhysX experts to see what that's all about, but I'm making progress, now just to figure out what it is I did there :)

Cheers!

xp
Post Reply