Commits

German Larrain committed 3a77907

collision.adapters.Engine: changed type from static to class the methods
'near_callback', 'are_geoms_connected', 'is_ray', 'handle_ray_collision'.

Comments (0)

Files changed (1)

ars/model/collision/adapters.py

 	# Functions and methods not overriding base class functions and methods
 	#==========================================================================
 
-	@staticmethod
-	def near_callback(args, geom1, geom2):
+	@classmethod
+	def near_callback(cls, args, geom1, geom2):
 		"""Callback function for the collide() method (in ODE). This function
 		checks if the given geoms do collide and creates contact joints (c_joint)
 		if they do, except if they are connected."""
 		ray_geom = None
 		other_geom = None
 
-		if args.ignore_connected and Engine.are_geoms_connected(geom1,
-			geom2):
+		if args.ignore_connected and cls.are_geoms_connected(geom1, geom2):
 			return
 
 		#======================================================================
 		# Ray's special case
 		#======================================================================
-		if Engine.is_ray(geom1):
-			if Engine.is_ray(geom2):
+		if cls.is_ray(geom1):
+			if cls.is_ray(geom2):
 				print('Weird, ODE says two rays may collide. '
 				      'That case is not handled.')
 				return
 				ray_geom = geom1
 				other_geom = geom2
 
-		elif Engine.is_ray(geom2):
+		elif cls.is_ray(geom2):
 			ray_geom = geom2
 			other_geom = geom1
 
 		for c in contacts:
 
 			if ray_geom is not None:
-				Engine.handle_ray_collision(ray_geom, other_geom, c)
+				cls.handle_ray_collision(ray_geom, other_geom, c)
 			else:  # we create a ContactJoint only if both geoms are not rays
 				# set contact parameters
 				c.setBounce(c_joint_bounce)
 				j = ode.ContactJoint(world, contact_group, c)
 				j.attach(geom1.getBody(), geom2.getBody())
 
-	@staticmethod
-	def are_geoms_connected(geom1, geom2):
+	@classmethod
+	def are_geoms_connected(cls, geom1, geom2):
 		"""Are `geom1` and `geom2` connected (through the bodies they are
 		attached to)?
 		"""
 		return ode.areConnected(geom1.getBody(), geom2.getBody())
 
-	@staticmethod
-	def is_ray(geom):
+	@classmethod
+	def is_ray(cls, geom):
 		"""Return whether ``geom`` is a :class:`ode.GeomRay` object or not.
 
 		:param geom:
 		"""
 		return isinstance(geom, ode.GeomRay)
 
-	@staticmethod
-	def handle_ray_collision(ray, other_geom, contact):
+	@classmethod
+	def handle_ray_collision(cls, ray, other_geom, contact):
 		# pos: intersection position
 		# depth: distance
 		(pos, normal, depth, geom1, geom2) = contact.getContactGeomParams()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.