About Store Forum Documentation Contact



Post Reply 
Create / Remove Objects.
Author Message
Xhizors Offline
Member

Post: #1
Create / Remove Objects.
What is the correct way to add/remove object from the world?

Add:
CObjectClass *pObj; = ... etc

Game::ObjParams &obj = *Game::Objs("obj/chr/Human/0.obj");
Game::World.objCreate( obj, Matrix(obj.scale(),Vec( pObj->x, pObj->z+1, pObj->y )));

// Reference to the Chr object.
pObj->objRef = mCharacters[ mCharacters.elms()-1 ];

Remove

pCharacters.removeData( &it->second->objRef() );

Can't you add something like Game::World.objRemove( objRef() );

Or how do you guys remove objects from the world?

Thank you
(This post was last modified: 04-19-2010 10:22 PM by Xhizors.)
04-19-2010 10:20 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #2
RE: Create / Remove Objects.
If I'm not mistaken, if you override the update method for the object and return false, it will be removed.
04-19-2010 11:18 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #3
RE: Create / Remove Objects.
(04-19-2010 11:18 PM)Rofar Wrote:  If I'm not mistaken, if you override the update method for the object and return false, it will be removed.

That's correct

U can use:
PHP Code:
ObjMemb::remove
or
PHP Code:
Item::update()
{
return 
false;


~Dynad

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 04-20-2010 02:19 AM by Dynad.)
04-20-2010 02:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Xhizors Offline
Member

Post: #4
RE: Create / Remove Objects.
It was easier then I thought, to just return false in the update method smile
04-21-2010 07:34 AM
Find all posts by this user Quote this message in a reply
Post Reply