A little mentoring needed

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
cyberbillp
Posts: 12
Joined: Tue Jan 04, 2005 11:54 pm
Location: florida
Contact:

A little mentoring needed

Post by cyberbillp »

Hi all.
I must say this looks like an excellent community surrounding an excellent engine (I'm sucking up - lol).

Anyways, I been programming on and off for hmmm, well, since the 70's on paper teletypes. And I actually took a c++ course once. But like everything if you don't use it, you loose it, and I've never written anything in C++, at least not in the last ten years or so.

So. I'm coming up to speed on this, tinkering with the demo's and tutorials. I learn by doing, but I'm not actually sure I am reading the code correctly. (It's much easier if I can actually fully grasp the code. At one time I could actually think in C.... Made programming easier I'll tell you).

On to the point.
If someone could tell me if I am reading this correctly, it would be much appreciated:
IAnimatedMesh* mesh = smgr->getMesh("../../media/SpaceFighter01.3ds");

I'm guessing that IAnimatedMesh* is a definition and it's a pointer. And mesh is the variable name, and smgr->getMesh("../../media/SpaceFighter01.3ds"); calls getMesh and returns a pointer into the variable mesh. I'm not clear on smgr->. I'm guessing this is passing the scene handle or pointer to getMesh? I forgot how -> works and my C++ book isn't helping much.

Moving on, I think I understand this more or less:
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh);

So reading the API docs, I see you can assign a node to a parent node. Being creative I thought I'd try an experiment (it's how one learns eh?).

So I created a camera node like this (is this correct?):
ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS();

Then I used this to load the mesh:
IAnimatedMesh* mesh = smgr->getMesh("../../media/SpaceFighter01.3ds");

Then I tried to create a node with the camera as a parent node and this is where I hosed it up.
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh, cam, vector3df(0,30,-40), vector3df(0,5,0 ));

I think I'm close......... But somewhere I'm making an incorrect assumption. Can I not do this? I figured using the fps camera would be a cheap way to move around etc.

If anyone cares: I'd ultimately like to end up with a space combat game. I have a very specific idea in mind for recreating a classic game, but instead of doing it in text, Id like to do it in 3D. *cough* megawars /stellar warrior *cough*
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Are you sure the mesh is getting loaded?

As far as smgr, that is a pointer to an ISceneManager object, and it's done to prevent having to call -
device->getSceneManager ( )... everytimg you want to use the scene manager. So you do,

ISceneManager* smgr = device->getSceneManager ( );

'->' is the C++ way to dereference pointer object. smgr is just a 4 byte memory pointer, but by derefercing it with '->' the compiler tried to access the object that memory address points to.

Anyways, other than you're mesh not loading, I'm not sure what the problem is. Do you have compiler output we can look at?
cyberbillp
Posts: 12
Joined: Tue Jan 04, 2005 11:54 pm
Location: florida
Contact:

mentoring

Post by cyberbillp »

Thanks, I think I understand the -> operator now.

I have no idea where I found in the api docs where it said to pass co-ordinates to addAnimatedMeshSceneNode(), but now I can't find where it says that in the docs. Soooo, I got it to compile with out the co-ordinates. Thanks for the help!

I'll be back crying for more soon enough. lol
Post Reply