Hello!
Quick question. When doing comparisons of Objects for boolean tests (if, while, etc), when asking if A = B, is this doing a reference check, or is something else going on? Does it depend on the platform?
I have a circular reference made because of box2d's UserData, so that in a b2ContactListener I can refer to the actual object in the game -- let's call it Thing -- which contains both the box2d physics data (the body and fixture references in the b2World), as well as extra data used for visual elements. What I also have is a class called ThingUserData, which has a member of type Thing that is a reference back to the original Thing associated with it.
What I'm wondering here is, say in my engine I have a Things:Thing[] for rendering stuff in the non-box2d part, and an extension of b2ContactListener to detect collisions. If I want to know if the box2d body matches my Thing in the list, can I simply do this?
If contact.GetFixtureA().GetBody().GetUserData = Things[0] Or
contact.GetFixtureB().GetBody().GetUserData = Things[0] Return True
Will that check the references to see if they're equal, since they're Objects? Or will it be checking something else more stringent?
|