MD2 model loading

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
thojoh370
Posts: 12
Joined: Sun Nov 04, 2007 7:22 pm
Location: Linköping, Sweden
Contact:

MD2 model loading

Post by thojoh370 »

Hey!
I have been looking in the tutorials for help about this issue, but all I could find was example projects that didn't give me a clue at all... because I had trouble implementing the examples into the project of mine.

What I want to do is to load an MD2 mesh and then bind a texture to it. Then move the loaded model to a specified vector location.

Any solutions to that?
Programmers don't DIE, they just GOSUB and then RETURN.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

The tutorials should be reaaaally useful here as that's exactly what they do in most of them. Any of the tutorials with the Sydney (lass in a black spandex suit) model are loading an MD2 model.

Do you want to move the model to a point immediately or do you want it to walk/run there?

Take the Hello World tutorial for example, all it does really is load a Sydney model, which is what you want:

Code: Select all

IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2"); // loads the model
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh ); // creates a node so the model gets rendered
if (node)
{
	node->setMaterialFlag(EMF_LIGHTING, false); // turns off lighting so we can see her
	node->setFrameLoop(0, 310);	// Sets the animation
	node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") ); // Sets the texture
        node->setPosition(vector3df(0,0,0)); // sets her position to 0,0,0
}
Image Image Image
thojoh370
Posts: 12
Joined: Sun Nov 04, 2007 7:22 pm
Location: Linköping, Sweden
Contact:

FPS

Post by thojoh370 »

What I am making is an FPS, so I might want it to try run to the player's position (which is instantly changed so the model's destination has to be instantly changed as well). But I will try that code and see if it works for me (anything I need to include?).

EDIT: Code worked. Now I just need to bind it to actions (so that it doesn't just stand there; running without moving) - I want it to react to keypresses and change animation according to that.

Also I need to know how to increase the brightness?
Programmers don't DIE, they just GOSUB and then RETURN.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

For key presses check out the tutorials as they show you how to use an event reciever (most of them do).

In fact just work through all the tutorials as it seems you haven't done that yet. They'll answer a lot of 'newbie' questions you might come up with and should get you up and running with a good start on an FPS game. For example the movement tutorial should help you with a way of getting your character to run to a certain point.

As for increasing the brightness i'm not sure there's any easy way of doing that with any settings...
Image Image Image
Post Reply