Problem with entities being removed from the world

Problem with entities being removed from the world

Basically I've been messing around a bit with the sdk trying to get a feel for things (great stuff btw) but I can't seem to figure out what might cause the world to lose track of an entity without an explicit call to removeEntity(). All I am doing is adding a bunch of objects to the world and removing them once they are deactivated. Would removing one objectpossibly cause another to be removed as well? If so how, and what can be done to prevent it? If someone could take a look at line 50 in Havok.cpp and maybe give me some insight as to why this is happening that would be great :)

Havok.h -

Havok.cpp -

4 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hey Ernegien,

I haven't run your code so I'm not 100% if this is the root of the problem or not, but I thought it was strange that you're iterating over Objects after doing:


Giving full ownership to the world means that your pointer in that List may no longer be valid. If you're retaining a pointer for future use, then the reference count should be kept at two: one for you and one for the world.

As far as the activation thing goes: why are you removing entities when they become inactive? "Havok uses simulation islands" to improve performance. Rather than running collision detection on every entity every step, only "active" entities (entities in "active" simulation islands) have collision detection run. Entities are grouped into simulation islands and these islands are activated/deactivated based on a few parameters (whether or not actions are being applied to them, constraint existence, bounding box overlaps with active entities...).

Hope these pointers give you a place to start looking.

Let me know if you've any questions on the above,

Thanks for the quick reply. I completely understand how simulation islands work, this code was just to make sure I can add/remove entities without problems. I finally figured out that there was a small indexing error in my List class which was to blame. Everything works fine now, but thanks for clarifying the use of references :)

Glad you got it figured out! Make sure to keep us up to date on how your project goes :-)


Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!