Jump to content

  • Log In with Google      Sign In   
  • Create Account


how remove a model

  • You cannot reply to this topic
8 replies to this topic

#1 Landi20   Members   -  Reputation: 200

Like
0Likes
Like

Posted 14 August 2014 - 01:08 PM

i create a model in 3d but when i make logout and go to login class i don´t want show the model as been create in world class



Sponsor:

#2 belfegor   Crossbones+   -  Reputation: 2563

Like
5Likes
Like

Posted 14 August 2014 - 06:26 PM

ok



#3 Landi20   Members   -  Reputation: 200

Like
0Likes
Like

Posted 15 August 2014 - 04:56 AM

but i don´t know how remove the model

i find soluction

with this code

 this.Game.GameSystems.Remove(this);


Edited by Landi20, 15 August 2014 - 05:27 AM.


#4 TiagoCosta   Crossbones+   -  Reputation: 2048

Like
0Likes
Like

Posted 15 August 2014 - 05:31 AM

i make logout and go to login class i don´t want show the model as been create in world class

 

logout and login from where? what world class? are you using a game engine?

 

(It seems you're having trouble explaining your problem in english, are you portuguese (in your profile it says you're in Viana do Castelo)? If so, send me a private message with your question in portuguese and I'll try to help you)



#5 Landi20   Members   -  Reputation: 200

Like
0Likes
Like

Posted 15 August 2014 - 05:38 AM

i find the soluction i only have to add a new line of code

 

this.Game.GameSystems.Remove(this);



#6 Aardvajk   Crossbones+   -  Reputation: 5958

Like
0Likes
Like

Posted 15 August 2014 - 07:14 AM

i find the soluction i only have to add a new line of code

 

this.Game.GameSystems.Remove(this);

 

I have no idea what language or library you are using, but be careful of calling a method like remove() with a this pointer or reference. If you access any members of the object following that line, it is likely to crash your application (depending on what language you are using).

 

C++ example:

ListOfThings things;

void removeThing(Thing *t)
{
    things.remove(t);
}

class Thing
{
public:
    void destroyMe()
    {
        remove(this);
        print(health); // crash, this points to deallocated memory
    }

    int health;
};

It is normally better to remove things at a higher level than have an instance remove itself from a container.



#7 Landi20   Members   -  Reputation: 200

Like
0Likes
Like

Posted 15 August 2014 - 07:15 AM

i using sharpdx and i programaing in c#



#8 Aardvajk   Crossbones+   -  Reputation: 5958

Like
0Likes
Like

Posted 15 August 2014 - 07:29 AM

No idea how C# handles this. Guess since it is garbage collected, the instance will still exist for the rest of the method so you're probably okay. Its just conceptually confusing to have objects delete themselves generally speaking.



#9 Landi20   Members   -  Reputation: 200

Like
0Likes
Like

Posted 15 August 2014 - 09:46 AM

ok thanks







PARTNERS