Jump to content

FreeEntity question


ZeroByte
 Share

Recommended Posts

Hi, sorry if this has been asked before.

 

When i call FreeEntity

 

if(KeyHit(KEY_DELETE)) {
if(pick.entity != NULL) {
FreeEntity(pick.entity);
pick.entity=NULL;
}
}

 

is there a way to free the physics body ?

 

I know there must be a way, or i'm just blind. :)

Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.

Link to comment
Share on other sites

Since a model is an extension of the body class, and models are entities -> Would freeing a model entity not also free its associated physics body?

 

Well, i delete the windmill model in my app, but the physics body remains.

 

I have tried changing entity type also, but the physics body is still there.

Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.

Link to comment
Share on other sites

Hmm, well i can mouse pick any model and it happens.

 

So what should i use to delete the physics body ?

 

Or is the mouse pick the problem ?

 

Thank's.

Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.

Link to comment
Share on other sites

You should try to get the parent of your mesh and check if it is a model.

In that case you can use FreeEntity and it would delete the complete model.

 

 

This code should work, if your entity is a model:

if(KeyHit(KEY_DELETE)) 
{
       if(pick.entity != NULL) 
       {
           TEntity parent = GetEntityParent(pick.entity);
           FreeEntity(parent);
           parent=NULL;
       }
}

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...