Hello everyone, new here.
My question is simple: I have a game where there are different types of bodies. Some are enemies, some are terrain, some are friends, etc. The structure of my code with regards to this is different classes for the enemies, the player, etc, all of which store a body they refer to. When this body is created, it takes information from these classes and uses that to change itself, and then returns itself to the class for use later. This works out fine and dandy, until things collide.
I need to figure out what types objects are when they collide, but I’m only able to get a body. The bodies are unable to tell which entity they associate with, only the other way around. How would I go about solving this? I’m aware of UserData, but I already store a texture there for use by another library. It requires that the texture be there. Is there any other way to store multiple objects in a body’s userdata?
Thanks for any help.
Edit: at work right now so I can’t test this, but the thought just occurred to me–since it’s possible to attach multiple fixtures to a body, would I be able to place a different object of userData in each of them?