Commits

German Larrain committed 9357cc5

simulator.Simulation: '_world' attribute is now a wrapped World object, independent of the physics
engine, and it is not created by 'phs_engine.create_world' function but by class
'phs_engine.world_class' constructor.

  • Participants
  • Parent commits a8a27a8

Comments (0)

Files changed (4)

ars/model/collision/adapters.py

 		c_joint_bounce = 0.2 # default: 0.2
 		c_joint_mu = 500 # default: 500. 0-5 = very slippery, 50-500 = normal, 5000 = very sticky
 
-		world = args.world
+		world = args.world._inner_object
 		contact_group = args.contact_group
 		ray_geom = None
 		other_geom = None

ars/model/physics/adapters.py

 def _create_ode_capsule(world, length, radius, mass=None, density=None):
 
 	capsule_direction = 3 # z-axis
-	body = ode.Body(world)
+	body = ode.Body(world._inner_object)
 
 	if mass is not None:
 		m = ode.Mass()
 
 def _create_ode_cylinder(world, length, radius, mass=None, density=None):
 	cylinderDirection = 3 # Z-axis
-	body = ode.Body(world)
+	body = ode.Body(world._inner_object)
 
 	if mass is not None:
 		m = ode.Mass()
 	return body
 
 def _create_ode_box(world, size, mass=None, density=None):
-	body = ode.Body(world)
+	body = ode.Body(world._inner_object)
 
 	if mass is not None:
 		m = ode.Mass()
 	return body
 
 def _create_ode_sphere(world, radius, mass=None, density=None):
-	body = ode.Body(world)
+	body = ode.Body(world._inner_object)
 
 	if mass is not None:
 		m = ode.Mass()

ars/model/robot/joints.py

 class Fixed(Joint):
 	def __init__(self, world, body1, body2):
 		try:
-			inner_joint = ode.FixedJoint(world)
+			inner_joint = ode.FixedJoint(world._inner_object)
 			inner_joint.attach(body1.inner_object, body2.inner_object)
 			inner_joint.setFixed()
 
 	def __init__(self, world, body1, body2, anchor, axis):
 
 		try:
-			inner_joint = ode.HingeJoint(world)
+			inner_joint = ode.HingeJoint(world._inner_object)
 			inner_joint.attach(body1.inner_object, body2.inner_object)
 			inner_joint.setAnchor(anchor)
 			inner_joint.setAxis(axis) # see contrib.Ragdoll.addHingeJoint for possible modification
 	def __init__(self, world, body1, body2, anchor, axis1, axis2):
 
 		try:
-			inner_joint = ode.UniversalJoint(world)
+			inner_joint = ode.UniversalJoint(world._inner_object)
 			inner_joint.attach(body1.inner_object, body2.inner_object)
 			inner_joint.setAnchor(anchor)
 			inner_joint.setAxis1(axis1) # see contrib.Ragdoll.addHingeJoint for possible modification
 	def __init__(self, world, body1, body2, anchor):
 
 		try:
-			inner_joint = ode.BallJoint(world)
+			inner_joint = ode.BallJoint(world._inner_object)
 			inner_joint.attach(body1.inner_object, body2.inner_object)
 			inner_joint.setAnchor(anchor)
 

ars/model/simulator/__init__.py

 	def add_basic_simulation_objects(self):
 		"""create the basic simulation objects"""
 		self._contact_group = self.phs_engine.create_joint_group() # for the contact joints generated during collisions
-		self._world = self.phs_engine.create_world() # create a world object (physical)
+		self._world = self.phs_engine.world_class() # create a world object (physical)
 		self._space = coll.Space()
 
 	def on_idle(self):