Commits

German Larrain  committed e1a0562

simulator.Simulation: new method 'add_slider_joint'

  • Participants
  • Parent commits 8d9eb1b
  • Branches dev-joints

Comments (0)

Files changed (1)

File ars/model/simulator/__init__.py

 		bs_joint = jo.BallSocket(self._world, body1, body2, anchor)
 		return self.add_joint(SimulatedJoint(name, bs_joint))
 
+	def add_slider_joint(self, name, obj1, obj2, axis):
+		"""Add a :class:`jo.Slider` joint between obj1 and obj2.
+
+		The only movement allowed is translation along ``axis``.
+
+		:return: the name under which the slider was stored, which could be
+		different from the given ``name``
+
+		"""
+		body1 = obj1.body
+		body2 = obj2.body
+
+		s_joint = jo.Slider(self._world, body1, body2, axis)
+		return self.add_joint(SimulatedJoint(name, s_joint))
+
 
 class SimulatedObject:
 	__metaclass__ = ABCMeta