Jump to content

[Help - C++] Add hook for every entity


Rastar
 Share

Recommended Posts

I would like to have a hook function getting called for every entity in the scene, without explicitly registering it for every entity. There is a hook in the Map::Load function, but my guess is that would not work for dynamically created entities (?)

 

Is there a method for that?

Link to comment
Share on other sites

Hi Roland, thanks for answering! Yes, that should work for entities loaded with the map, but I would also like to hook into events for dynamically created entities. And since I am writing some sort of generic, reusable C++ library that doesn't know about entity creation by other parts of the code, I cannot simply hard-code a hook registration after e.g. a call to Model::Create(). So I was looking for a possibility to generically hook into events for any entity, not just map-based ones. I would like to write some information about every entity in the scene after it has been rendered (using DrawHook) into GPU buffers, for later usage in the post-processing.

 

Is there such a registration call? I am thinking of something like World::EntityInstantiatedHook (which obviously doesn't exist).

Link to comment
Share on other sites

I think you'd have to loop over the world->entities list to get all entities loaded (this will be via the map or manual load it doesn't matter. if it got loaded and a world was created it'll be part of that world). So basically you can make your own function like you describe if you like via this method.

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...