contact listener events?

is it possible to tell an actor class to call an event if the custon contact listener calls add?

basicly would it be possible to make an event listener that the actor can respond to.
useruser3 wrote:
is it possible to tell an actor class to call an event if the custon contact listener calls add?

basicly would it be possible to make an event listener that the actor can respond to.


not entirely sure what you are after, but all you have to do to get to your userData (which can be any class, a MovieClip etc) is this in the b2ContactListener.as

var myObject = point.shape1.GetBody().GetUserData();

and then do what you want with myObject, call it's functions, use it's var's etc. and that would go in the "Add" function of the Contactlistener.
so there isnt a way to give the actor an onAdd function so it can respond directly to the contact rather than putting lots of code in my contact listener?
useruser3 wrote:
so there isnt a way to give the actor an onAdd function so it can respond directly to the contact rather than putting lots of code in my contact listener?


I don't use actors, but as far as I know they are just a basic class setup to store data for your game. I've been putting "lots of code" in my b2ContactListener.as file on the Add function without any problems at all.

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