(09-06-2011 04:07 AM)EnergyX Wrote: Could you please tell me what are the other files that Warrior meshs uses ?
I think everything you need for the Warrior is in that folder itself. Strange, must have been some other file that was missing, not really sure what that could be though.
(09-06-2011 04:07 AM)EnergyX Wrote: Is it possible to create an object with "param.type(false);" and get the object pointer ? I am trying to avoid declaring an object type and an array for something that isn't used in big amount, such as the local player which there is only one of this.
Game::World.objCreateNear returns a pointer to the object, but this requires you to use ObjMemx<Player>.
To avoid manually specifying param values via code, you can create .obj files in the Object mode of World Editor. Just fill out the values as you would if you were going to place an object in the world, except hit File > Save (on the same "Temp Object" window) and save it out. Then, you can load it in via code:
Code:
Game::ObjParams ¶m = *Game::Objs.ptrRequire("Obj/Chr/Warrior/0.obj");
Game::World.objCreate(param, matrix);
----------
I've never tried this, but it might work if you just keep a Player class in constant memory and manually call the create/update/draw methods:
Code:
Player player;
Bool Init()
{
// ...
Game::World.New(..);
ObjParam ¶m = *Game::Objs.ptrRequire("Obj/Chr/Warrior/0.obj");
player.create(param);
}
Bool Update()
{
// ...
Game::World.update();
Player.update();
}
void Render()
{
Game::World.draw();
switch(Renderer()) {
case RM_PREPARE: {
player.drawPrepare();
break;
}
case RM_SHADOW: {
player.drawShadow();
break;
}
}
}
Never tested this, so code might not be bug-free or even work. Think I might try testing it after this...
----------
So, I tried testing this code just now and, to my surprise, it worked first try!
Honestly, I think I may just like this technique better than using an ObjMemx container for the Player class (assuming you're only ever going to need 1 player). Good question!