help getting cube n syndey out of program

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
enigmaseti
Posts: 7
Joined: Wed Sep 19, 2007 3:58 pm

help getting cube n syndey out of program

Post by enigmaseti »

newbie...
trying to figure out the Ir GE. is not there any list that actually explains each class and what it does?
I am trying to modify one of the examples.

1. remove the cube.
2. replace 'syndey' with a non animated mesh... spaceship.3ds
3. control the camera in y.p.r. axis as in a fps.

1 n 2 is my biggest problem. can not find how to load a 3ds object and attach to node. since the 3ds object is not animated what class would i use?

thanks.
TomiZ
Posts: 40
Joined: Wed Aug 29, 2007 6:02 am
Location: Poland
Contact:

Post by TomiZ »

Full documentation is in doc/irrlicht.chm and http://irrlicht.sourceforge.net/docu/index.html

1. This code is adding cube scene node.

Code: Select all

scene::ISceneNode* n = smgr->addCubeSceneNode();

	if (n)
	{
		n->setMaterialTexture(0, driver->getTexture("../../media/t351sml.jpg"));
		n->setMaterialFlag(video::EMF_LIGHTING, false);
		scene::ISceneNodeAnimator* anim =
			smgr->createFlyCircleAnimator(core::vector3df(0,0,30), 20.0f);
		n->addAnimator(anim);
		anim->drop();
	}
You can remove it or use

Code: Select all

 
	n->remove();
to remove it from scene after some time.

2. You can use any (supported) mesh as animated mesh scene node.

3. Use search engine to check forum - there is many examples.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I think enigmaseti is actually using one of the tutorials (movement?) and wants to remove from the source code the code that adds in the cube and sydney.

The tutorial source code though explains each step of the way so it should be very clear what code to delete to stop these things being added. TO not add the cube just remove any mention of the cubeSceneNode.

No matter what model you are loading you pretty much always use the same code to load it and then that function decided what model loading code to call based on the extension of the file. So just replace the path to sydney.md2 to the path to your spaceship and it will work.
Image Image Image
enigmaseti
Posts: 7
Joined: Wed Sep 19, 2007 3:58 pm

Post by enigmaseti »

TomiZ, thanks for the pointer to the web info......

JP, you are correct. I did replace all ref to sydney with my 3ds name and it does display it. What I am wondering, since the spaceship is not animated it there a different class without the added overhead of animation, since i am not animating the ship?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yes, there is, i'm not sure if it really saves a huge amount but it's good practice to do it properly i suppose!

I think you'd do this instead:

IMesh = smgr->getMesh("spaceship.3ds")->getMesh(0);
ISceneNode* spaceshipNode = smgr->addMeshSceneNode(mesh);

getMesh(path) always returns an IAnimatedMesh* so if you want to make an unanimated node you just grab the first frame of the mesh and use that.
Image Image Image
Post Reply