ZeroByte Posted April 10, 2010 Posted April 10, 2010 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. Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.
Mumbles Posted April 10, 2010 Posted April 10, 2010 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? Quote LE Version: 2.50 (Eventually)
ZeroByte Posted April 10, 2010 Author Posted April 10, 2010 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. Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.
Josh Posted April 10, 2010 Posted April 10, 2010 You are deleting a mesh that is a child of the model. Quote Let's build cool stuff and have fun.
ZeroByte Posted April 10, 2010 Author Posted April 10, 2010 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. Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.
DaDonik Posted April 12, 2010 Posted April 12, 2010 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; } } Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)
AggrorJorn Posted April 12, 2010 Posted April 12, 2010 I don't know how C++ works but with Lua it's done this way: repeat if pick.entity:GetClass()==ENTITY_MODEL then break end pick.entity=pick.entity.parent until pick.entity==nil Quote
ZeroByte Posted April 12, 2010 Author Posted April 12, 2010 Ok, so i need to delete the parent, thank's for the help everyone. Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.
Recommended Posts
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.