Xhizors
Member
|
Remove Objects.
Any way to remove world objects? like objRemove.
I'm doing a std::list of the Player structure, Then I push_back objects into that list, and on the constructor I add the object into the world and on the destructor I want to remove the object from the world.
Ho do you guys handle the objects management in the game?
|
|
08-28-2009 09:04 AM |
|
menajev
Member
|
Re: Remove Objects.
If you have objects in Memb just find index of element and use array.remove(index).
|
|
08-28-2009 09:45 AM |
|
Xhizors
Member
|
Re: Remove Objects.
Ok thanks.
So if I have a Memx of players.
Game::ObjMemx< Player* > mPlayers;
How do you create objects using Memx then?
You do the same like a vector or?
Player *pNew = new Player();
mPlayers.AddInSomeWay?( pNew );
Or how do you handle it?
|
|
08-28-2009 09:54 AM |
|
Esenthel
Administrator
|
Re: Remove Objects.
please check the tutorial "dynamically created objects" or something like that in "game basics" folder
|
|
08-28-2009 10:18 AM |
|
Xhizors
Member
|
Re: Remove Objects.
Esenthel Wrote:please check the tutorial "dynamically created objects" or something like that in "game basics" folder
How do you get access to them to set the camera and movements?
|
|
08-28-2009 11:20 AM |
|
Xhizors
Member
|
Re: Remove Objects.
I do like this.
Object gets created.
Game::ObjParams &obj=*Game::Objs("obj/item/misc/barrel/0.obj");
Game::World.objCreate(obj,Matrix(obj.scale(),Vec(36,8,31) ));
Object failed to get created.
Game::Obj *pNew = Game::World.objCreateNear(obj,Matrix(obj.scale(),Vec(36,8,31) ));
I also add this object to my InGame List.
mPlayers.push_back( static_cast< Player* > ( pNew ) );
Why don't the object gets created using objCreateNear? That is the only way to get the reference right?
|
|
08-28-2009 11:35 AM |
|
Esenthel
Administrator
|
Re: Remove Objects.
objCreateNear will work only if the area is loaded
|
|
08-28-2009 12:12 PM |
|