def forward_dynamics(self, action):
        if len(action) != self.action_dim:
            raise ValueError('incorrect action dimension: expected %d but got '
                             '%d' % (self.action_dim, len(action)))
        lb, ub = self.action_bounds
        action = np.clip(action, lb, ub)
        for ctrl, act in zip(self.extra_data.controls, action):
            if ctrl.typ == "force":
                for name in ctrl.bodies:
                    body = find_body(self.world, name)
                    direction = np.array(ctrl.direction)
                    direction = direction / np.linalg.norm(direction)
                    world_force = body.GetWorldVector(direction * act)
                    world_point = body.GetWorldPoint(ctrl.anchor)
                    body.ApplyForce(world_force, world_point, wake=True)
            elif ctrl.typ == "torque":
                assert ctrl.joint
                joint = find_joint(self.world, ctrl.joint)
                joint.motorEnabled = True
                # forces the maximum allowed torque to be taken
                if act > 0:
                    joint.motorSpeed = 1e5
                else:
                    joint.motorSpeed = -1e5
                joint.maxMotorTorque = abs(act)
            else:
                raise NotImplementedError
        self.before_world_step(action)
        self.world.Step(
            self.extra_data.timeStep,
            self.extra_data.velocityIterations,
            self.extra_data.positionIterations
        )
dataset/ETHPy150Open rllab/rllab/rllab/envs/box2d/box2d_env.py/Box2DEnv.forward_dynamics/original