About Store Forum Documentation Contact



Post Reply 
Remove Object from World
Author Message
Lancer Offline
Member

Post: #1
Remove Object from World
Hi,

I've searched on how to remove an object from the world and found this.
https://www.esenthel.com/forum/showthrea...from+world

It says I could use a command like
Code:
ObjMemb::remove*
But I could not find anything about "ObjMemb"
Is there any other way to remove it without having to return "false" in update function?
07-26-2019 08:06 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #2
RE: Remove Object from World
if its an object created from the game.world you can use this:
ObjMap& remove ( Int i ); // remove i-th object from container
ObjMap& removeId (C UID &obj_id); // remove object from container by its ID
ObjMap& removeObj(C TYPE *data ); // remove object from container by its memory address

once you create your world you can populate an ObjMap container, and easely remove it from there when you want.

if would still suggest that return false in the update is a little clearer, but its up to you.
(This post was last modified: 07-26-2019 10:37 PM by RedcrowProd.)
07-26-2019 10:35 PM
Find all posts by this user Quote this message in a reply
Lancer Offline
Member

Post: #3
RE: Remove Object from World
Im worried, if I just remove it from the ObjMap itself, it won't be properly removed from the world?
07-27-2019 12:08 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Remove Object from World
Those ObjMap methods will remove objects properly
07-27-2019 02:21 AM
Find all posts by this user Quote this message in a reply
Lancer Offline
Member

Post: #5
RE: Remove Object from World
Is it safe removing the object from the ObjMap while in update function ?
07-27-2019 10:33 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Remove Object from World
It's dangerous only if you remove object during the update for the object itself. (Obj.update)
But State update is safe.
07-27-2019 02:05 PM
Find all posts by this user Quote this message in a reply
Post Reply