(self, settings, action=None)
The main physics step.

        Takes care of physics drawing
        (callbacks are executed after the world.Step() )
        and drawing additional information.
The main physics step.
The main physics step .
def Step(self, settings, action=None):
        """
        The main physics step.

        Takes care of physics drawing
        (callbacks are executed after the world.Step() )
        and drawing additional information.
        """
        assert action is None,\
            'action should only be used in subclass'

        self.stepCount += 1
        # Don't do anything if the setting's Hz are <= 0
        if settings.hz > 0.0:
            timeStep = 1.0 / settings.hz
        else:
            timeStep = 0.0

        # Set the flags based on what the settings show
        if self.renderer:
            self.renderer.flags = dict(
                drawShapes=settings.drawShapes,
                drawJoints=settings.drawJoints,
                drawAABBs=settings.drawAABBs,
                drawPairs=settings.drawPairs,
                drawCOMs=settings.drawCOMs,
                convertVertices=isinstance(self.renderer, b2.b2DrawExtended)
            )

        # Set the other settings that aren't contained in the flags
        self.world.warmStarting = settings.enableWarmStarting
        self.world.continuousPhysics = settings.enableContinuous
        self.world.subStepping = settings.enableSubStepping

        # Reset the collision points
        self.points = []

        # Tell Box2D to step
        t_step = time()
        self.world.Step(timeStep, settings.velocityIterations,
                        settings.positionIterations)
        t_step = time()-t_step

        # Update the debug draw settings so that the vertices will be properly
        # converted to screen coordinates
        t_draw = time()
        if self.renderer:
            self.renderer.StartDraw()

        self.world.DrawDebugData()

        if self.renderer:


            # Draw each of the contact points in different colors.
            if self.settings.drawContactPoints:
                for point in self.points:
                    if point['state'] == b2.b2_addState:
                        self.renderer.DrawPoint(self.renderer.to_screen(
                            point['position']), settings.pointSize,
                                                self.colors['contact_add'])
                    elif point['state'] == b2.b2_persistState:
                        self.renderer.DrawPoint(self.renderer.to_screen(
                            point['position']), settings.pointSize,
                                                self.colors['contact_persist'])

            if settings.drawContactNormals:
                for point in self.points:
                    p1 = self.renderer.to_screen(point['position'])
                    p2 = self.renderer.axisScale * point['normal'] + p1
                    self.renderer.DrawSegment(p1, p2,
                                              self.colors['contact_normal'])

            self.renderer.EndDraw()
            t_draw = time()-t_draw

            t_draw = max(b2.b2_epsilon, t_draw)
            t_step = max(b2.b2_epsilon, t_step)


            self.t_draws.append(1.0/t_draw)
            self.t_steps.append(1.0/t_step)
def Step ( self , settings , action = None ) : assert action is None , 'action should only be used in subclass' self . stepCount += 1 # Don't do anything if the setting's Hz are <= 0 if settings . hz > 0.0 : timeStep = 1.0 / settings . hz else : timeStep = 0.0 # Set the flags based on what the settings show if self . renderer : self . renderer . flags = dict ( drawShapes = settings . drawShapes , drawJoints = settings . drawJoints , drawAABBs = settings . drawAABBs , drawPairs = settings . drawPairs , drawCOMs = settings . drawCOMs , convertVertices = isinstance ( self . renderer , b2 . b2DrawExtended ) ) # Set the other settings that aren't contained in the flags self . world . warmStarting = settings . enableWarmStarting self . world . continuousPhysics = settings . enableContinuous self . world . subStepping = settings . enableSubStepping # Reset the collision points self . points = [ ] # Tell Box2D to step t_step = time ( ) self . world . Step ( timeStep , settings . velocityIterations , settings . positionIterations ) t_step = time ( ) - t_step # Update the debug draw settings so that the vertices will be properly # converted to screen coordinates t_draw = time ( ) if self . renderer : self . renderer . StartDraw ( ) self . world . DrawDebugData ( ) if self . renderer : # Draw each of the contact points in different colors. if self . settings . drawContactPoints : for point in self . points : if point [ 'state' ] == b2 . b2_addState : self . renderer . DrawPoint ( self . renderer . to_screen ( point [ 'position' ] ) , settings . pointSize , self . colors [ 'contact_add' ] ) elif point [ 'state' ] == b2 . b2_persistState : self . renderer . DrawPoint ( self . renderer . to_screen ( point [ 'position' ] ) , settings . pointSize , self . colors [ 'contact_persist' ] ) if settings . drawContactNormals : for point in self . points : p1 = self . renderer . to_screen ( point [ 'position' ] ) p2 = self . renderer . axisScale * point [ 'normal' ] + p1 self . renderer . DrawSegment ( p1 , p2 , self . colors [ 'contact_normal' ] ) self . renderer . EndDraw ( ) t_draw = time ( ) - t_draw t_draw = max ( b2 . b2_epsilon , t_draw ) t_step = max ( b2 . b2_epsilon , t_step ) self . t_draws . append ( 1.0 / t_draw ) self . t_steps . append ( 1.0 / t_step )