Permalink
Browse files

mechanic fixes

  • Loading branch information...
BorisKolganov committed Sep 5, 2018
1 parent 3f91bdd commit a7987c87b5aab1cf3df8f355d754fe609f27e4df
@@ -35,6 +35,7 @@ class Car(object):
rear_wheel_friction = 1
rear_wheel_elasticity = 0.8
rear_wheel_joint = (0, 0)
rear_wheel_groove_offset = 5
rear_wheel_damp_position = (0, 0)
rear_wheel_damp_length = 20
rear_wheel_damp_stiffness = 6e4
@@ -46,6 +47,7 @@ class Car(object):
front_wheel_friction = 1
front_wheel_elasticity = 0.8
front_wheel_joint = (0, 0)
front_wheel_groove_offset = 5
front_wheel_damp_position = (0, 0)
front_wheel_damp_length = 20
front_wheel_damp_stiffness = 6e4
@@ -84,6 +86,7 @@ def create_wheel(self, wheel_side):
wheel_position = getattr(self, wheel_side + '_wheel_position')
wheel_friction = getattr(self, wheel_side + '_wheel_friction')
wheel_elasticity = getattr(self, wheel_side + '_wheel_elasticity')
wheel_grove_offset = getattr(self, wheel_side + '_wheel_groove_offset')
wheel_damp_position = getattr(self, wheel_side + '_wheel_damp_position')
wheel_damp_length = getattr(self, wheel_side + '_wheel_damp_length')
wheel_damp_stiffness = getattr(self, wheel_side + '_wheel_damp_stiffness')
@@ -100,7 +103,7 @@ def create_wheel(self, wheel_side):
wheel_objects.append(wheel_shape)
wheel_grove = pymunk.GrooveJoint(self.car_body, wheel_body,
(wheel_damp_position[0] * self.x_modification, wheel_damp_position[1]),
(wheel_damp_position[0] * self.x_modification, wheel_damp_position[1] - wheel_grove_offset),
(wheel_damp_position[0] * self.x_modification,
wheel_damp_position[1] - wheel_damp_length * 1.5),
(0, 0))
@@ -104,6 +104,7 @@ def create_wheel(self, wheel_side):
wheel_position = getattr(self, wheel_side + '_wheel_position')
wheel_friction = getattr(self, wheel_side + '_wheel_friction')
wheel_elasticity = getattr(self, wheel_side + '_wheel_elasticity')
wheel_grove_offset = getattr(self, wheel_side + '_wheel_groove_offset')
wheel_damp_position = getattr(self, wheel_side + '_wheel_damp_position')
wheel_damp_length = getattr(self, wheel_side + '_wheel_damp_length')
wheel_damp_stiffness = getattr(self, wheel_side + '_wheel_damp_stiffness')
@@ -120,7 +121,7 @@ def create_wheel(self, wheel_side):
wheel_objects.append(wheel_shape)
wheel_grove = pymunk.GrooveJoint(self.car_body, wheel_body,
(wheel_damp_position[0] * self.x_modification, wheel_damp_position[1]),
(wheel_damp_position[0] * self.x_modification, wheel_damp_position[1] - wheel_grove_offset),
(wheel_damp_position[0] * self.x_modification,
wheel_damp_position[1] - wheel_damp_length * 1.5),
(0, 0))
@@ -37,14 +37,14 @@ def create_box(self, space):
left.sensor = True
top = pymunk.Segment(space.static_body, (-bo, self.max_height + bo),
(self.max_width + bo, self.max_height + bo), 10)
(self.max_width + bo, self.max_height + bo), self.segment_height)
top.sensor = True
right = pymunk.Segment(space.static_body, (self.max_width + bo, self.max_height + bo),
(self.max_width + bo, -bo), 10)
(self.max_width + bo, -bo), self.segment_height)
right.sensor = True
bottom = pymunk.Segment(space.static_body, (self.max_width + bo, -bo), (-bo, -bo), 10)
bottom = pymunk.Segment(space.static_body, (self.max_width + bo, -bo), (-bo, -bo), self.segment_height)
bottom.sensor = True
self.objects.extend([left, top, right, bottom])

0 comments on commit a7987c8

Please sign in to comment.