'Returns the current motion vector indicating the velocity of the
player.
Returns
vector : tuple of len 3
Tuple containing the velocity in x, y, and z respectively.'

def get_motion_vector(self):

    if any(self.strafe):
        (x, y) = self.rotation
        strafe = math.degrees(math.atan2(*self.strafe))
        y_angle = math.radians(y)
        x_angle = math.radians((x + strafe))
        if self.flying:
            m = math.cos(y_angle)
            dy = math.sin(y_angle)
            if self.strafe[1]:
                dy = 0.0
                m = 1
            if (self.strafe[0] > 0):
                dy *= (-1)
            dx = (math.cos(x_angle) * m)
            dz = (math.sin(x_angle) * m)
        else:
            dy = 0.0
            dx = math.cos(x_angle)
            dz = math.sin(x_angle)
    else:
        dy = 0.0
        dx = 0.0
        dz = 0.0
    return (dx, dy, dz)
