Help with attaching .md2 to FPS Camera

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
Sfin
Posts: 13
Joined: Wed Oct 15, 2003 9:13 pm

Help with attaching .md2 to FPS Camera

Post by Sfin »

Alright I have looked through the forum, and tryed some fo the suggested idea's, but for some reason they don't work for me. I ain't a graphics programmer, so please can you exaplin your answers.

I am using engine 0.4.0, and I tried it with a .md2, and a .3ds models, and I get the same results.

Here is my problem:

I am trying to attach a gun to a CameraSceneNodeFPS as a child, so that it moves, and rotates with it like any gun in a FPS should do. This is what my code looks like, and take into account that this is just a test case, and the design for my program is going to be completly different.

The rpoblem is that my md2 mesh doesn't move with my camera. I had the program output the position of X for the camera & node, and they camera moves, but the node doesn't change its position at all.

Code: Select all


//Global Camera & Node
scene::ICameraSceneNode* camera = 0;
IAnimatedMeshSceneNode* node = 0;

//In Main
	camera = smgr->addCameraSceneNodeFPS();
	device->getCursorControl()->setVisible(false);

	core::vector3df posWeaponCam(10,-15,15);

	IAnimatedMesh* mesh = smgr->getMesh(test->getMeshName());
	node = smgr->addAnimatedMeshSceneNode( mesh, camera, 0, posWeaponCam );

	if(node){

		node->setMaterialFlag(EMF_LIGHTING, false);
		//node->setFrameLoop(0, 310);
		node->setMaterialTexture(0,                     driver->getTexture(test->getTextureName()));

	}

In the above test is a Weapon class, which in the future will be an AnimatedSceneNode, but for now only contains two const Char*, which have the mesh name, and texture name.


Thanks for any replies.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hi, I think this is a bug, which will be fixed in the next release. But I'm not sure. Are you using verions 0.4.1?
Ironfoot
Posts: 15
Joined: Fri Aug 22, 2003 12:30 pm
Location: Germany
Contact:

Post by Ironfoot »

He wrote he uses 0.4.0, not 0.4.1.
Maybe you fixed the Bug already, niko.
Great Engine, Niko, keep up the good work!
Saalen
Posts: 51
Joined: Thu Sep 04, 2003 7:49 am
Location: Germany
Contact:

Post by Saalen »

I don't think its a bug, I am doing the same here http://irrlicht.sourceforge.net/phpBB2/ ... .php?t=347 and it works with 041.
Maybe you recycle any of your pointers somewhere later in your code? :wink:
Guest

Post by Guest »

Oh my GOD I am an idiot. Apparently it is a bug in the 0.4.0 release, because based on your suggestions I changed to the 0.4.1 build, and it works like a charm.

Also niko, for a non graphics developer I have to say that you have a great engine here. Very easy to use. Now all I have to do is learn how to design a proper game engine for my teams game, so off to learning.

For anyone that is interested here is the site:

www.ex-3.net, so if anyone is interested just post a reply or send us an e-mail

I am s9albalo in the forums.

Thanks.
Sfin
Posts: 13
Joined: Wed Oct 15, 2003 9:13 pm

Post by Sfin »

The above post is me.

Thanks again guys for the quick responses.
Post Reply