Dynad
Member
|
Create Dynamically objects
Hey,
Ive a question about the functions: objCreateNear(); and objCreate()... How does these functions work? Is there an example to make my own version?
Thnx,
~Dynad
There is always evil somewhere, you just have to look for it properly.
|
|
01-03-2011 06:00 PM |
|
Salival
Member
|
RE: Create Dynamically objects
(01-03-2011 06:00 PM)Dynad Wrote: Hey,
Ive a question about the functions: objCreateNear(); and objCreate()... How does these functions work? Is there an example to make my own version?
Thnx,
~Dynad
What do you mean by "make my own version"?
usage is like this:
Code:
Vec pos(0,0,0);
Game::ObjParams &obj = *Game::Objs("Obj/chr/mesh.obj");
Game::World.objCreate(obj, Matrix(obj.scale(), pos));
Or if you want to access them or put them into some map you can do something like this.
Code:
struct CUser : Game::Chr
{
void Initialize(); //Custom data / animations etc.
};
Game::ObjMemx<CUser> CEngineEntries;
Bool GameWorld::Init()
{
//! Setup type.
Game::World.setObjType(CEngineEntries, OBJ_ENTRY);
}
map<unsigned long, Reference<CUser> > ObjectEntriesMap;
/*!
AddUserObject.
*/
void CWorldHandler::AddUserObject(unsigned long objectID)
{
//! Create world object.
Game::ObjParams &obj = *Game::Objs("Obj/chr/mesh.obj");
Game::World.objCreate(obj, Matrix(obj.scale(), Vec(0,0,0)));
//! Get pointer from world object.
CUser *pObj = static_cast<CUser*>(&CEngineEntries[CEngineEntries.elms()-1]);
//! Initialize new object.
pObj->Initialize(data);
//! Add new Entry.
ObjectEntriesMap[objectID] = pObj;
//! Get UserData from map.
CUser *pObjData = ObjectEntriesMap[objectID];
pObjData->blabla
}
Good luck
(This post was last modified: 01-03-2011 08:12 PM by Salival.)
|
|
01-03-2011 08:12 PM |
|
Dynad
Member
|
RE: Create Dynamically objects
well i wanted to know whats inside that function not how to use it. But i think i can just create the game::chr without the world class.
There is always evil somewhere, you just have to look for it properly.
|
|
01-03-2011 08:35 PM |
|
Esenthel
Administrator
|
RE: Create Dynamically objects
you can't write custom objCreate
but you're right, you can use Game classes without the World Manager
|
|
01-04-2011 12:31 AM |
|