userdata as short or integer?

Hi,

Is it possible to override userdata for fixtures? I would like my fixtures' userdata to simply be a short int instead of a void pointer and due to my inexperience in C++ I am having difficulty doing so.

Is there a simple way to do this without creating a class and setting the class to the userdata field?

All I'd like is my body's userdata to hold the class I use, but place a short id into the fixture field for my own purposes.

If its not possible to put a number of my choice in the userdata field, could you show me how to override without modifying box2D source code?

Thank you for your help with userdata 🙂
You don't need to do anything special. Just store the integer in the place of the void*.

Code:
void* userData = NULL;
userData = (void*)42;
int userData_as_integer = (int)userData;
assert( userData_as_integer == 42 );
caspin, thank you 🙂

Original thread: https://box2d.org/forum/viewtopic.php?t=4512