About Store Forum Documentation Contact



Post Reply 
Remove Objects.
Author Message
Xhizors Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
menajev Offline
Member

Post: #2
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
Find all posts by this user Quote this message in a reply
Xhizors Offline
Member

Post: #3
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
Re: Remove Objects.
please check the tutorial "dynamically created objects" or something like that in "game basics" folder
08-28-2009 10:18 AM
Find all posts by this user Quote this message in a reply
Xhizors Offline
Member

Post: #5
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
Find all posts by this user Quote this message in a reply
Xhizors Offline
Member

Post: #6
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
Re: Remove Objects.
objCreateNear will work only if the area is loaded
08-28-2009 12:12 PM
Find all posts by this user Quote this message in a reply
Post Reply