German Larrain committed a6815f0

model.collision: added signal dispatching for:
-ray pre and post set last contact,
-ray pre and post clear last contact,
-ray pre and post clear closer contact.

Comments (0)

Files changed (1)


 from abc import ABCMeta, abstractmethod
 import ars.exceptions as exc
+from ars.lib.pydispatch import dispatcher
+from ars.model.collision import signals
 class Engine:
 	__metaclass__ = ABCMeta
 		checks if `last_contact` is closer than the previously existing one.
 		The result can be obtained with the `get_closer_contact` method.
+		dispatcher.send(signals.RAY_PRE_SET_LAST_CONTACT, sender=self)
 		if self._last_contact is None:
 			self._closer_contact = last_contact
 			if self._last_contact.depth > last_contact.depth:
 				self._closer_contact = last_contact
 		self._last_contact = last_contact
+		dispatcher.send(signals.RAY_POST_SET_LAST_CONTACT, sender=self)
 	def clear_last_contact(self):
+		dispatcher.send(signals.RAY_PRE_CLEAR_LAST_CONTACT, sender=self)
 		self._last_contact = None
+		dispatcher.send(signals.RAY_POST_CLEAR_LAST_CONTACT, sender=self)
 	def clear_closer_contact(self):
+		dispatcher.send(signals.RAY_PRE_CLEAR_CLOSER_CONTACT, sender=self)
 		self._closer_contact = None
+		dispatcher.send(signals.RAY_POST_CLEAR_CLOSER_CONTACT, sender=self)
 	def clear_contacts(self):